Nel

Nel

  • NA
  • 716
  • 1.1m

Problem with the select query

Mar 14 2012 8:04 AM
Hi,

I have this select query

SELECT Avtobusi.Garbr, Max(Avtobusi.Data_implem) AS MaxOfData_implem
FROM Avtobusi
where Avtobusi.Sloboden=true

GROUP BY Avtobusi.Garbr;

but this considers the Avtobusi.Sloboden first and than the max(Avtobusi.Data_implem) (it takes the rows where it is true for the certain Garbr regardless that there are rows after that with newer date with values "false" for Avtobusi.Garbr). In fact, with this query I get rows which are true for Avtobusi.Sloboden, and I want first to get the last Data_implem row for the certain Garbr (the newest date row), and if it has true (checked) value for Avtobus.Sloboden to select it, otherwise not to select it.

Caould anybody help me how to change teh select query to achive the above described.

Thanks in advance.

Answers (1)