By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,766 Members | 1,295 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,766 IT Pros & Developers. It's quick & easy.

Why would SELECT returned record sequence change? SQL Server 2005

P: 1
I have the following SELECT statement

SELECT MU.SUBID,
MU.LOCID,
MU.MENUCAT,
MU.MENUNAME,
MU.RECIPENAME,
RC.HAS_NUTRIENTS
FROM FR_MENUS AS MU
LEFT OUTER JOIN FR_RECIPES AS RC
ON MU.SUBID=RC.SUBID AND MU.LOCID=RC.LOCID AND MU.RECIPENAME=RC.RECIPENAME
WHERE MU.SUBID='NH10200901' AND MU.LOCID='WestJeff'

The PK of MU table is SUBID,LOCID,MENUCAT,MENUNAME. This query was been returning records in that sequence.

After adding a new field to the RC table, this query now returns records in a different sequence. I then removed the new field from RC and still have the problem.

Also, removing the WHERE clause returns records in the correct sequence.

ORDER BY SUBID,LOCID,MENUCAT,MENUNAME fixes the problem, but should not be necessary.

Can anyone explain what is happening?
Feb 4 '10 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Here, read this

Good Luck!!!

~~ CK
Feb 4 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.