This is stupid, I used to be able to do this all the time by mistake now I can't do it on purpose
I want to be able to return a full list of matching records when only one is true
Like
Row 1, ID_1, false
Row 2, ID_1, false
Row 3, ID_1, true
Row 4, ID_2, false
Row 5, ID_2, true
Row 6, ID_2, false
I currently get
Row 3, ID_1, true
Row 5, ID_2, true
In order for us to help you, you need to give us better information. We dont know what you are trying to do, what query you are using/what version of SQL you are using etc. Please post all the relevant information.|||
I think I have got it, using a derived table
Using the results from the derived table to join to the main table and substituting the ClosedDate in the main table with the ClosedDate from the Derived table
Of course I have no idea if this is the best solution
SELECT
derivedEvents.ClosedDate, derivedEvents.IRefFROM(SELECTClosedDate, IRef
FROMdbo.tblOCompEvents
WHERE(ClientID = ClientID)AND(IRef = IRef)AND(closed = 1))ASderivedEventsINNER JOIN
dbo.tblOCompEventsAStblOCompEvents_1ONderivedEvents.IRef = tblOCompEvents_1.IRef
ORDER BYderivedEvents.IRef|||
I have postedmy solution but any thing better... thanks for your interest
In my table I have events for client activity eventualy each series of events will be closed and a date inserted
the user wants to review all events for each client where the series has been closed, previously I could only return the closed row not the whole series
This is for a report which lists all events for all clients where the series of events has been closed
No comments:
Post a Comment