I am having trouble with a particular query. My question is I have a table called FOO in this table i have four columns. The first column is a software title. The next column is a software title that replaced column1. The third column is the date the software in column2 was created. And the third column is the date that the software in column1 was created. Here is the layout:
TABLE FOO
O_TITLE char(200),
N_TITLE char(200),
O_DATE time,
N_TITLE time
What I need is a select statement that selects only the new software titles from the Table. Keep in mind that a title can be in the O_TITLE and the N_TITLE if it is replaced and then it replaces another title.
But I want the latest instance, and I cannot modify the table.
I can do this with a while loop and multiple select statements but I am looking for a SQL query that will do it in one step.
Any help is appreciated,
MikeJ
TABLE FOO
O_TITLE char(200),
N_TITLE char(200),
O_DATE time,
N_TITLE time
What I need is a select statement that selects only the new software titles from the Table. Keep in mind that a title can be in the O_TITLE and the N_TITLE if it is replaced and then it replaces another title.
But I want the latest instance, and I cannot modify the table.
I can do this with a while loop and multiple select statements but I am looking for a SQL query that will do it in one step.
Any help is appreciated,
MikeJ