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
jatrojoomla [ Mo, 28 August 2006 15:11 ] [ ID #1446902 ]

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
>

I'm not sure what you're asking. What are you trying to do?

P.S. This isn't a php question. It's strictly a SQL question.
alt.php.sql and php.general removed from the reply.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex [at] attglobal.net
==================
Jerry Stuckle [ Mo, 28 August 2006 17:46 ] [ ID #1446903 ]

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/en/group-by-modifiers.ht ml

--
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-)
IchBin [ Di, 29 August 2006 00:23 ] [ ID #1446904 ]

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/en/group-by-modifiers.ht ml

--
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-)
IchBin [ Di, 29 August 2006 00:23 ] [ ID #1447208 ]

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 [at] gmail.com> wrote in message
news:1156770696.026364.285250 [at] 74g2000cwt.googlegroups.com...
>I am trying to use GROUP BY cluse, what is the utility of this cluse in
> MySQL
> plz. any body tell me
>
Duane Phillips [ Di, 29 August 2006 02:54 ] [ ID #1448215 ]

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
Justin [ Di, 29 August 2006 07:20 ] [ ID #1448216 ]

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 [at] askme.askme> wrote in message
news:-audnb5pUZioDW7ZnZ2dnUVZ_rOdnZ2d [at] 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 [at] gmail.com> wrote in message
> news:1156770696.026364.285250 [at] 74g2000cwt.googlegroups.com...
>>I am trying to use GROUP BY cluse, what is the utility of this cluse in
>> MySQL
>> plz. any body tell me
>>
>
>
Duane Phillips [ Di, 29 August 2006 07:27 ] [ ID #1448217 ]

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 [at] gmail.com> wrote in message
news:1156770696.026364.285250 [at] 74g2000cwt.googlegroups.com...
>I am trying to use GROUP BY cluse, what is the utility of this cluse in
> MySQL
> plz. any body tell me
>
Duane Phillips [ Di, 29 August 2006 02:54 ] [ ID #1448607 ]

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
Justin [ Di, 29 August 2006 07:20 ] [ ID #1448609 ]

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 [at] askme.askme> wrote in message
news:-audnb5pUZioDW7ZnZ2dnUVZ_rOdnZ2d [at] 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 [at] gmail.com> wrote in message
> news:1156770696.026364.285250 [at] 74g2000cwt.googlegroups.com...
>>I am trying to use GROUP BY cluse, what is the utility of this cluse in
>> MySQL
>> plz. any body tell me
>>
>
>
Duane Phillips [ Di, 29 August 2006 07:27 ] [ ID #1448610 ]

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
Christoph Burschka [ Sa, 25 November 2006 10:51 ] [ ID #1547126 ]

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
Christoph Burschka [ Sa, 25 November 2006 10:51 ] [ ID #1547281 ]
Datenbanken » mailing.database.mysql » GROUP BY cluse

Vorheriges Thema: MySQL and VB.NET
Nächstes Thema: getting unique records