dbTalk Databases Forums  

about group by....

comp.databases.mysql comp.databases.mysql


Discuss about group by.... in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SpreadTooThin
 
Posts: n/a

Default about group by.... - 10-29-2010 , 01:59 PM






can you use the group by clause twice in an sql statement?

sql = "SELECT PatientName as 'Patient Name', PatientID as 'Patient
ID', PatientDOB as 'Birth Date', StudyDescription as 'Study
Description', SeriesDate as 'Study Date', COUNT(DISTINCT SeriesUID) AS
'Series In Study' FROM ImageTable WHERE CTPName LIKE '" + ctpn + "'
AND SeriesDate >= " + sds + " AND SeriesDate <= " + eds + " GROUP BY
StudyUID;"

before the ; can I add another 'group by somecolumn'

?

Reply With Quote
  #2  
Old   
matt
 
Posts: n/a

Default Re: about group by.... - 10-29-2010 , 02:39 PM






On Oct 29, 2:59*pm, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:
Quote:
can you use the group by clause twice in an sql statement?

* * sql = "SELECT PatientName as 'Patient Name', PatientID as 'Patient
ID', PatientDOB as 'Birth Date', StudyDescription as 'Study
Description', SeriesDate as 'Study Date', COUNT(DISTINCT SeriesUID) AS
'Series In Study' FROM ImageTable WHERE CTPName LIKE '" + ctpn + "'
AND SeriesDate >= " + sds + " AND SeriesDate <= " + eds + " GROUP BY
StudyUID;"

before the ; can I add another 'group by somecolumn'

?
GROUP BY accepts a comma-separated list of columns, like the field
list or the order by cause.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.