GROUP BY cluse

This is a discussion on GROUP BY cluse within the PHP General forums, part of the PHP Programming Forums category; I am trying to use GROUP BY cluse, what is the utility of this cluse in MySQL plz. any body ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-28-2006
jatrojoomla
 
Posts: n/a
Default GROUP BY cluse

I am trying to use GROUP BY cluse, what is the utility of this cluse in
MySQL
plz. any body tell me

Reply With Quote
  #2 (permalink)  
Old 08-28-2006
IchBin
 
Posts: n/a
Default Re: GROUP BY cluse

jatrojoomla wrote:
> I am trying to use GROUP BY cluse, what is the utility of this cluse in
> MySQL
> plz. any body tell me
>


Not sure, by your question, if you are asking how to use GROUP BY
clause. If you are then look here:

http://dev.mysql.com/doc/refman/5.1/...modifiers.html

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Reply With Quote
  #3 (permalink)  
Old 08-29-2006
Duane Phillips
 
Posts: n/a
Default Re: GROUP BY cluse

It works basically the same as in other SQL driven databases, excepting that
it uses single quotes for instead of double.

Sample of character, numerical, and table to table link in WHERE clause:

WHERE table1.field1 = 'some parameter' AND table1.field2 = 6 AND
table1.field5 = table3.field1

With character and date fields use single quote marks around the parameter
value, and skip the single quotes for numerical arguments.

This is the basic structure, but you can do far more operators and
nestings... but it is basically SQL 92 compliant (depending on your version
of MySQL, which you did not specify).

Cheers!

~ Duane Phillips.

"jatrojoomla" <jatrojoomla@gmail.com> wrote in message
news:1156770696.026364.285250@74g2000cwt.googlegro ups.com...
>I am trying to use GROUP BY cluse, what is the utility of this cluse in
> MySQL
> plz. any body tell me
>



Reply With Quote
  #4 (permalink)  
Old 08-29-2006
Justin
 
Posts: n/a
Default Re: GROUP BY cluse

example: SELECT * FROM abc WHERE name='abc' GROUP BY age

jatrojoomla wrote:
> I am trying to use GROUP BY cluse, what is the utility of this cluse in
> MySQL
> plz. any body tell me


Reply With Quote
  #5 (permalink)  
Old 08-29-2006
Duane Phillips
 
Posts: n/a
Default Re: GROUP BY cluse

OK. I posted my answer to the wrong message. *sigh*. Not my day.

And Group By has been handled enough by the other posters...

Cheers...

"Duane Phillips" <duane.phillips@askme.askme> wrote in message
news:-audnb5pUZioDW7ZnZ2dnUVZ_rOdnZ2d@giganews.com...
> It works basically the same as in other SQL driven databases, excepting
> that it uses single quotes for instead of double.
>
> Sample of character, numerical, and table to table link in WHERE clause:
>
> WHERE table1.field1 = 'some parameter' AND table1.field2 = 6 AND
> table1.field5 = table3.field1
>
> With character and date fields use single quote marks around the parameter
> value, and skip the single quotes for numerical arguments.
>
> This is the basic structure, but you can do far more operators and
> nestings... but it is basically SQL 92 compliant (depending on your
> version of MySQL, which you did not specify).
>
> Cheers!
>
> ~ Duane Phillips.
>
> "jatrojoomla" <jatrojoomla@gmail.com> wrote in message
> news:1156770696.026364.285250@74g2000cwt.googlegro ups.com...
>>I am trying to use GROUP BY cluse, what is the utility of this cluse in
>> MySQL
>> plz. any body tell me
>>

>
>



Reply With Quote
  #6 (permalink)  
Old 11-25-2006
Christoph Burschka
 
Posts: n/a
Default Re: GROUP BY cluse

Justin wrote:
> example: SELECT * FROM abc WHERE name='abc' GROUP BY age
>
> jatrojoomla wrote:
>> I am trying to use GROUP BY cluse, what is the utility of this cluse in
>> MySQL
>> plz. any body tell me

>


That isn't really useful, however.

A real application would be, for example, "SELECT age FROM abc GROUP BY age",
which does the same job as "SELECT DISTINCT age ...", selecting only those ages
that are different.

Or "SELECT age,count(*) FROM abc GROUP BY age", which will count the records for
each value of age.

--
CB
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:49 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0