Jump to content

SQL queries


jess

Recommended Posts

hii'm having real toruble writing a query in sql which does a group by command and limits the response to be greater than 3. i've been told my query is wrong but i don't know why.SELECT Hoilday_code, Count(Code_of_hoildays)as RecordCount FROM Details_of_hoildayGroup by Hoilday_codeWhere Length(Code_of_hoildays)> 3;above is my query can anyone tell whats wrong with it because i'm really have no ideathanksjessica

Link to comment
Share on other sites

You have to put the WHERE before the GROUP BY

SELECT Hoilday_code, Count(Code_of_hoildays)as RecordCountFROM Details_of_hoilday WHERE LENGTH(RecordCount) > 3GROUP BY Hoilday_code;

Link to comment
Share on other sites

hii've tried that and i've been told that its missing the missing right parenthesisSELECT Hoilday_code, Count(Code_of_hoildays)as RecordCountFROM Details_of_hoilday WHERE LENGTH(Code_of_hoildays as RecordCount)> 3GROUP BY Hoilday_code;

Link to comment
Share on other sites

... try what I posted above

SELECT Hoilday_code, Count(Code_of_hoildays)as RecordCountFROM Details_of_hoilday WHERE LENGTH(RecordCount) > 3GROUP BY Hoilday_code;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...