Answer the question
In order to leave comments, you need to log in
How to implement SQL query, select by date?
Compiled such request for selection of values from two tables (fields in which have communication "one to many"). At the same time, I get only those values that have the oldest "key", that is, they were recorded last.
SELECT tab1.indexObject, tab1.ObjectNames, tab2.XMLizmerenije, tab2.XMLdate, tab2.dateMessage, max(tab2.dateMessage) FROM tab1 JOIN tab2
ON (tab1.keyID = tab2.indexObjectsTab_id)
WHERE tab2.dateMessage > 0 and tab1.indexObject = 11222
Answer the question
In order to leave comments, you need to log in
At the same time, I get only those values \u200b\u200bthat have the highest "key"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question