sql - How to get the last date from 2 dates in select statement -
I am trying to make a selection statement in the process.
Here is my code:
Buy from SELECT u.id, max (a.time), max (b.time) a, sell b, user uk WHERE A.user_id = u.id and b.user_id = u.id by GROUP uad; I need to take the last date between maximum (a.time) and maximum (time. Time) . > Thanks in advance
select u.id, max (Case when a time> BTT, A.Time and B.Time and A) Buy from A, B, Users U, A User UID UID and BUSIRIDUID UUID Group You UDID; If your DB supports aliased queries, try it which will be more efficient:
SELECT u.id, case when a_max & Gt; B_mx then buy A_ MX and B_mx from the end (SELECT u.id, max (a.time) a_max, max (b.time) as b_max, buy a, b, user u WHERE a.user_id = u .id and b User_id = u.id GROUP BY u.id) x; You can use the Inner Signal Index, if they existed to get the maximum for each column.
We are on it, let us re-code it using the modern addition syntax:
SELECT u Buy a buy for sale from .id, max (in case when a.time & gt; b.time then a.time second b. Timed out) b.user_id = u.id user auser_id = u.id GROUP BY U.id;
Comments
Post a Comment