I have the following data:
id pointValue datetime
620 0 1-2-15 13:33
621 1 2-2-15 13:33
622 2 3-2-15 13:33
623 3 4-2-15 13:33
I need to create a SQL query when id=620 and id=623 and get the following:
id1 pointValue1 datetime1 id2 pointValue2 datetime2
620 0 1-2-15 13:33 623 3 4-2-15 13:33
What I really want to do is to combine both result set in a simple row. I have tried with
SELECT MPV.id, MPV.pointValue FROM pointvalues AS MPV WHERE MPV.id = "620"
UNION
SELECT MPV.id, MPV.pointValue FROM pointvalues AS MPV WHERE MPV.id = "629"'
but this gives me different rows and I need just one.
Thanks in advanced, Izaskun
SELECT MPV.id, MPV.pointValue, MPV1.id, MPV1.pointValue
FROM pointvalues AS MPV
LEFT OUTER JOIN pointvalues AS MPV1
ON MPV1.id = "629"
WHERE MPV.id = "620"
ORDER BY MPV.id;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.