In a MYSQL table with those 5 fields: id, user_id, date, type, uid
where type
can be 1
or 2
, I'm looking for a single query where I can fetch 2 results, one for type=1 and another one for type=2 based on date field.
Right now i have the following query which only gives me the last uid without taking care of the type
field.
SELECT t.uid FROM table AS t WHERE t.user_id = 666 ORDER BY t.date DESC LIMIT 1
Does anyone know how should modify this query so i can get the last uid for type=1 and the last one for type=2 based on date field? I would like to keep a a single query