GREATEST() and LEAST() Functions
The values specified can be numeric, string, or date/time values, that means GREATEST() and LEAST() takes numeric, string, or date/time values as argument.SELECT GREATEST(4, 83, 0, 9, -3);
SELECT BookID, BookTitle, PublisherID
FROM Books
WHERE PublisherID=GREATEST(@id1, @id2, @id3, @id4, @id5)
ORDER BY BookTitle;
Here PublisherID is the greatest value among given values.
SELECT LEAST(4, 83, 0, 9, -3);
SELECT BookID, BookTitle, PublisherID
FROM Books
WHERE PublisherID=LEAST(@id1, @id2, @id3, @id4, @id5)
ORDER BY BookTitle;
Here PublisherID is the least value among given values.
No comments:
Post a Comment