
February 23rd, 2004, 10:31 AM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Count without Group By
I have a working SQL statement that returns record information from a records table as well as the number of items in the items table linked to the records table. The Query looks like this:
SELECT mn_records.*, count(mn_items.parentRecord) AS [itemCount]
FROM mn_records, mn_items
WHERE mn_records.recordID = '01-0126500'
AND mn_items.parentRecord = '01-0126500'
GROUP BY mn_items.parentRecord, mn_records.recordID,
mn_records.title, mn_records.author, mn_records.publisher,
mn_records.imgURL, mn_records.descrip, mn_records.documentType,
mn_records.series, mn_records.gradeLevel, mn_records.language,
mn_records.length, mn_records.callNumber, mn_records.ISBN
It works fine and returns exactly what I want, but is there anyway to trim the GROUP BY statement? I'm not even sure why it's necessary, but the server chokes if it isn't there.
|