Link to home
Avatar of soozh
soozhFlag for Sweden

asked on

Query syntax

I have three tables which i have joined in as below.

This query returns many rows of data and is nearly what i want.

However how would i only get the rows where dbo.Documents.doc_id is at its maxium?


SELECT        dbo.Applications.app_id, dbo.Applications.app_XMSApplicationID, dbo.Applications.app_XMSApplicationName, dbo.Applications.app_Active, 
                     dbo.DocumentData.ddt_FieldName, dbo.DocumentData.ddt_FieldValue, dbo.Documents.doc_id
FROM          dbo.Applications
                     INNER JOIN dbo.Documents ON dbo.Applications.app_XMSApplicationID = dbo.Documents.doc_ApplicationID
                     INNER JOIN dbo.DocumentData ON dbo.Documents.doc_id = dbo.DocumentData.doc_id
					 where  dbo.Applications.app_XMSApplicationID = 62

Open in new window

Avatar of Kelvin Sparks
Kelvin Sparks
Flag of New Zealand image

I'm not sure I understand what you mean by where dbo.Documents.doc_id is at its maximum. Do you want the records only where the Doc_ID is the largest value - in other words only one doc_id?


Kelvin
SOLUTION
Avatar of Louis01
Louis01
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Thanks! Cheers, Paul