I have these objects, an event table and a table to map my objects to my events.
My select statement selects the most recent event for each object and if it meets certain requirements then the object's id is returned.
something like
Expand|Select|Wrap|Line Numbers
- select o.id from
- objects o, events e, objecteventmap oem,
- (select max(date), o.id from events e, objects o, objecteventmap oem
- where e.id = oem.eventid and o.id = oem.objectid) ss
- where
- o.id = oem.objectid and
- e.id = oem.eventid and
- o.id = ss.id and
- e.date = ss.date and
- <more where clause stuff>
Help!
Edit:
Ok so I broke apart my query to get a better look at the data. In .net for some reason my Max date is getting the wrong date for some events. I am getting the ides of march instead of the correct date for a bunch of them. The weird thing is I do not have March 15th entered in my data anywhere....