var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
I need to do a LEAST() and Greatest() function in SQL query.
Is this possible in anyway shape or form?
Here is an example...
tblTable.oneID = 4
tblTable.twoID = 5
SELECT ... LEAST(tblTable.oneID,tblTable.twoID) FROM tblTable
and it returns 4. Or in the GREATEST function, it would return 5.
Thanks in advance
I think i figured it out...
LEAST function = SELECT (CASE WHEN oneID < twoID THEN oneID ELSE twoID) as LeastOFtheTWO FROM ...
GREATEST function = SELECT (CASE WHEN oneID > twoID THEN oneID ELSE twoID) as LeastOFtheTWO FROM ...
You are on the right track. Try the following for the least case:
select case when (a < b) then a else b end
from (select min(field1) as a, min(field2) as b from table) as abc