Microsoft
Software
Hardware
Network
Question : SQL Query
Hello,
Have a table that is based on a report - it creates a record for each new version of the report so you could conceivably get 1 - 10+ versions of a report. I need to eliminate all the older versions and show just the most recent. The table is set up as:
Report_Amendment
Report_Root_ID (original (first)report created)
Report_New_ID
Report_OLD_ID
CREATED_DATE
ex of data below:
46 47 46 2009-04-16 09:37:33.123
46 48 47 2009-04-16 09:38:13.477
46 1167 48 2009-08-03 13:29:53.653
So I want to isolate just the most recent record but my query below does not do this, it gives me all the records except the first - I`ve tried several things but am not sure that I am thinking about this logically - can anybody give me direction...Thank you
SELECT dbo.Report_Amendment.Repor
t_Root_ID,
dbo.Report_Amendment.Repor
t_New_ID,
dbo.Report_Amendment.Repor
t_OLD_ID,d
bo.Report_
Amendment.
CREATED_DA
TE
FROM dbo.Report_Amendment
WHERE dbo.Report_Amendment.Repor
t_OLD_ID <> dbo.Report_Amendment.Repor
t_Root_ID
AND dbo.Report_Amendment.Repor
t_Root_ID = 46
GROUP BY dbo.Report_Amendment.CREAT
ED_DATE,db
o.Report_A
mendment.R
eport_Root
_ID,
dbo.Report_Amendment.Repor
t_OLD_ID,d
bo.Report_
Amendment.
Report_New
_ID
HAVING dbo.Report_Amendment.Repor
t_New_ID = MAX(dbo.Report_Amendment.R
eport_New_
ID)
Answer : SQL Query
hmmm...not really. what are you concerned of? it should be a descriptive name, but you can always use restore filelistonly to get the logical names in the backup.
Random Solutions
Deploying printers group policy server 2003 and server 2008
Oracle Query Tuning
Indentity Integration Feature Pack 2
Does anyone have experience with Microsoft Azure SQL services?
Desctription and title in Google results different
DB Mirroring / Auto-Failover, but ODBC?
Combine rows and sum fields
Putting name and information on bottom right of desktop screen
insert into tablename select *,colname(s) from similar_tablename; when table columns diff by one or more column names
function runs once, then error: "ïs not a function"