December 3, 2008 at 11:41 am
This is driving me crazy. I've done this before and I can't figure out why I'm getting this error. Can a fresh pair of eyes look at this, please?
SELECT tb1.[CNN], A.[CRN]
FROM Table1 tb1
join
(
SELECT TOP 1 cn2.[Change Notification Number], cn2.[Change Request Number]
FROM Table1 cn2
WHERE tb1.[Change Notification Number] = cn2.[Change Notification Number]
ORDER BY cn2.[Change Notification Number], cn2.[Change Request Number]
) A
ON a.[Change request Number] = tb1.[Change Notification Number]
December 3, 2008 at 12:30 pm
You cannot reference tb1 in the derived table. So you should remove this line from the derived table:
WHERE tb1.[Change Notification Number] = cn2.[Change Notification Number]
If you explain what the query is supposed to do you might get another solution offered.
Please see the links in my signature to see how to post to get better answers.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply