T SQL WHERE Clause
Posted
by johniom
on Stack Overflow
See other posts from Stack Overflow
or by johniom
Published on 2010-03-22T17:19:18Z
Indexed on
2010/03/22
17:21 UTC
Read the original article
Hit count: 316
Hiya Guys,
I'm trying to develop some code which pulls latest informtion only.
What it is when a user goes into a form there a subtable and everytime they change something it creates a new row in the colum called type12_OriginalNoteID which puts its own unquie number in. Another feild called type12_OriginalNoteID keeps the same number - which keeps track of what the oringal number was before any changes were made. I do have some code which does pull the latest information but it does not pull anything if the user has not made any changes to the form - and thats because the type12_OriginalNoteID is null.
The code is as follows
ea.type12_NoteID IN
(SELECT TOP 1 ea.type12_NoteID FROM UserAssessv1aidsadaptations ea1 WHERE
ea.type12_NoteID = ea1.type12_OriginalNoteID
ORDER BY ea.type12_UpdatedDate DESC)
An example of the data is as follows :-
type12_note ID - 12 type12_OriginalNoteID NULL type12_UpdatedDate - 11/03/2010
What would be the solution to show the ifnroamtion if no one has made any changes to the subtable? - adding an if statement to run if type12_OriginalNoteID is null??
© Stack Overflow or respective owner