T
tarweesh
hi,
let say i have a database of temperature reading or whatever.
i have a table t1 with fields (city_id, city_name, ...) and some other
info about the city.
and another table t2 (city_id, temperature, date) and i can have
several entries for each city.
i want to make a query that shows all the fields of t1 and the latest
temperature, i think one way to do this is to order t2 by date in a
descending order then select the first appearance of every city but i
failed to get the correct sql to do so.
so please if anybody knows how to do it this way or in any other way
this would be great.
let say i have a database of temperature reading or whatever.
i have a table t1 with fields (city_id, city_name, ...) and some other
info about the city.
and another table t2 (city_id, temperature, date) and i can have
several entries for each city.
i want to make a query that shows all the fields of t1 and the latest
temperature, i think one way to do this is to order t2 by date in a
descending order then select the first appearance of every city but i
failed to get the correct sql to do so.
so please if anybody knows how to do it this way or in any other way
this would be great.