Group By Question

Results 1 to 2 of 2

Thread: Group By Question

  1. #1
    Join Date
    Dec 1969

    Default Group By Question

    SELECT COUNT(*) AS iCount, * <BR>FROM PEP_DiaryEntry <BR><BR>There is an error whe i run the above statement. A group by clasuse from wat i see. <BR><BR>This is the table structure. <BR><BR>DiaryEntryID (PK)int <BR>DiaryID (FK)int <BR>MoodID (FK)int <BR>EntryDate date <BR>Entry nvarchar

  2. #2
    Join Date
    Dec 1969

    Default RE: Group By Question

    I don&#039;t think you can use count() and *. At least not in Access, and I don&#039;t think it will work in mysql either. (Because you can&#039;t group by a star(*) )<BR>What you need to do is to select the fields that you need and then GROUP BY the same fields that you selected. Like this:<BR>SELECT COUNT(*) AS iCount, field1, field2<BR>FROM PEP_DiaryEntry GROUP BY field1, field2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts