![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
given the following two tables, i am looking for help writing a query that returns all rows in table the first table along with the data from the second time with the latest (newest) timestamp. thanks! |
|
id name 1 A 2 B 3 C 4 D id time text 1 2010-06-23 20:40:00 first 1 2010-06-23 20:41:00 second 1 2010-06-23 20:42:00 third 2 2010-06-23 20:40:00 first 2 2010-06-23 20:41:00 second 2 2010-06-23 20:42:00 third 3 2010-06-23 20:40:00 first 3 2010-06-23 20:41:00 second 3 2010-06-23 20:42:00 third the result i would like from the query is: A third B third C third d null |
#3
| |||
| |||
|
|
given the following two tables, i am looking for help writing a query that returns all rows in table the first table along with the data from the second time with the latest (newest) timestamp. *thanks! id name 1 *A 2 *B 3 *C 4 *D id time * * * * * * * * * * * *text 1 *2010-06-23 20:40:00 first 1 *2010-06-23 20:41:00 second 1 *2010-06-23 20:42:00 third 2 *2010-06-23 20:40:00 first 2 *2010-06-23 20:41:00 second 2 *2010-06-23 20:42:00 third 3 *2010-06-23 20:40:00 first 3 *2010-06-23 20:41:00 second 3 *2010-06-23 20:42:00 third the result i would like from the query is: A third B third C third d null |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Sorry, meant to post the INNER JOIN strawberry type, not the sub- select... SELECT t1.text,t1.id,t1.insert_time FROM times t1 LEFT JOIN times t2 ON t1.id = t2.id AND t1.insert_time t2.insert_time WHERE t2.id IS NULL; |
![]() |
| Thread Tools | |
| Display Modes | |
| |