PDA

View Full Version : MsSQL question


tuinkle
02-08-2004, 11:19 AM
Hello,

It's me again :roll: , this time a question regarding MsSQL.
I got this example from a book (which I assumed to be a working example) and modified it a bit according to the database I'm working with, but it gives me a "title_id is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause" in DbVisualiser.


SELECT title_id, count(title_id) AS Number_of_Authors
FROM titleauthor
GROUP BY title_id
HAVING count(title_id) > 1


Does anybody have any clues what went wrong?

I'd appreciate any insights to this.
Thanks very much!
May[/code]

tuinkle
02-08-2004, 12:22 PM
Nevermind :)
I *think* I have it figured out.


*Database specific challenge*
It has to do with the uniqueness of title_id (it insists that title_id is unique in the trail table, and hence the inability to COUNT it). But I still think it shouldn't be unique... Argh.. found the issue in db, time to hack it....

Thanks for reading neways :)
May

chenchow
02-08-2004, 06:43 PM
May, good luck~! May be you can share what you have learned it here... It would be beneficial to others too~!