View Single Post
Old 04-27-2012, 01:00 AM   PM User | #5
katyD
New to the CF scene

 
Join Date: Apr 2012
Posts: 6
Thanks: 5
Thanked 0 Times in 0 Posts
katyD is an unknown quantity at this point
I'm so sorry, I'm clearly having one of those days.
I've attached a new zip with all 3 tables included.

I'll try to explain my problem a bit better. The problem part of the query is this bit:
SELECT webName, value AS titleSort, value AS title, pages.ID, catID, pageName, sortBy FROM pagesCats JOIN pagesIndex ON pagesCats.ID = pagesIndex.catID JOIN pages ON pagesIndex.pageID = pages.ID WHERE subsetOf = '2' GROUP BY catID

If I remove the GROUP BY (and add an ORDER, for clarity):

SELECT webName, value AS titleSort, value AS title, pages.ID, catID, pageName, sortBy FROM pagesCats JOIN pagesIndex ON pagesCats.ID = pagesIndex.catID JOIN pages ON pagesIndex.pageID = pages.ID WHERE subsetOf = '2' ORDER BY sortBy, catID

I can see that the webName for 'What's Happening' should be 'whats-happening' with a sortBy=0, but when I add the group back in, it is returning 'ScugogSportsHallofFame' with a sortBy=3

Does that help?
Attached Files
File Type: zip 20120426-sample-sql.zip (15.3 KB, 21 views)
katyD is offline   Reply With Quote