chris-uk-lad
Registered User.
- Local time
- Today, 15:11
- Joined
- Jul 8, 2008
- Messages
- 271
Currently have a series of select into statements which work fine for example:
This is placing the whole line of the record into a variable. Now the issue im having is a select into which contains an embedded select statement (finding the max date in a column). It seems to want 'FROM' to be used after the embedded statement, but that wouldnt work with the statement.
Much Appreciated
Code:
SELECT *
INTO R_Tab1
FROM TABLE1 WHERE ID = USER_ID AND Grouping = USER_Grouping AND Ref = 'NewLine';
This is placing the whole line of the record into a variable. Now the issue im having is a select into which contains an embedded select statement (finding the max date in a column). It seems to want 'FROM' to be used after the embedded statement, but that wouldnt work with the statement.
Code:
SELECT * INTO R_Tab1, (SELECT ID,MAX(DDate) AS MAXDATE
FROM Table1 WHERE Grouping= USER_Grouping AND ID = USER_ID AND Table1.Ref = 'NewLine' GROUP BY ID) MAXRESULTS
WHERE Table1.ID = MAXRESULTS.ID
AND Table1.DDate = MAXRESULTS.MAXDATE
AND Table1.Ref= 'NewLine'
Much Appreciated
Last edited: