Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
BaldEagle
Starting Member
23 Posts |
Posted - 2002-05-04 : 07:43:30
|
| SELECT COUNT(*) AS iCount, *FROM PEP_DiaryEntryThere is an error whe i run the above statement. A group by clasuse from wat i see.This is the table structure.DiaryEntryID (PK)intDiaryID (FK)intMoodID (FK)intEntryDate dateEntry nvarchar |
|
|
chadmat
The Chadinator
1974 Posts |
Posted - 2002-05-05 : 04:42:04
|
| What is it you are trying to get? This query will return an error because you need to have each of your select columns in a group by when used with an aggregate function (Like Count). So in your case all of the colums you listed would need to be in a group by clause.-Chad |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-05-06 : 00:11:14
|
| I second the question of "What is it you are trying to get?". It appears that your statement is attempting to return the total count of all rows in your table, AND the data from all rows. Is that what you want? Then perhaps you should look into SELECT @@ROWCOUNT after your SELECT * statement.OR, are you trying to return a recordset where each row has an incrementing integer to number them? In that case, you might do an INSERT into a temp table that has an IDENTITY field. But I doubt that you'll really want to do that for the entire table (i.e. you have no where clause or ORDER BY).So, again, what's the goal? Maybe there's a better way. |
 |
|
|
|
|
|