RE: Select and count duplicates

2002-12-03 Thread Parackov Eva, Ing
select headline, count(*) from headlines_table group by headline;

Eva Parackova
[EMAIL PROTECTED]

-Original Message-
From: Michelle de Beer [mailto:[EMAIL PROTECTED]]
Sent: 3. decembra 2002 13:27
To: mysql list
Subject: Select and count duplicates


I have a column containing headlines. In this column
there are some duplicates, like this:
---
monsters
headline1
monsters
halloween
monsters
halloween
...
--

How can I get a result like this instead?
HEADLINE   | HITS
---
monsters   | 3
halloween  | 2
headline1  | 1
---

Any thoughts?
// Michelle

Sql query

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Select and count duplicates

2002-12-03 Thread David Shapiro
Run this query as rs1:
select distinct scary_words from monsters_table; 

String word;
String query;
Int count;

while rs1.next() {
word = rs1.getString();
// Run this query as rs2
query = 'select count(*) from monster_table where scary_words=' +
word + '';

.
.
.
while rs2.next() {
// display your results (i.e., word count)


Use it to count them:
for
select count(*) 

-Original Message-
From: Michelle de Beer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 7:27 AM
To: mysql list
Subject: Select and count duplicates


I have a column containing headlines. In this column
there are some duplicates, like this:
---
monsters
headline1
monsters
halloween
monsters
halloween
...
--

How can I get a result like this instead?
HEADLINE   | HITS
---
monsters   | 3
halloween  | 2
headline1  | 1
---

Any thoughts?
// Michelle

Sql query

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Fw: Re: Select and count duplicates

2002-12-03 Thread DL Neil

- Original Message -
From: [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Sent: Tuesday, December 03, 2002 1:05 PM
Subject: Re: Re: Select and count duplicates


 Your message cannot be posted because it appears to be either spam or
 simply off topic to our filter. To bypass the filter you must include
 one of the following words in your message:

 sql,query

 If you just reply to this message, and include the entire text of it in
the
 reply, your reply will go through. However, you should
 first review the text of the message to make sure it has something to do
 with MySQL. Just typing the word MySQL once will be sufficient, for
example.

 You have written the following:

 Michelle,

  I have a column containing headlines. In this column
  there are some duplicates, like this:
  ---
  monsters
  headline1
  monsters
  halloween
  monsters
  halloween
  ...
  --
 
  How can I get a result like this instead?
  HEADLINE   | HITS
  ---
  monsters   | 3
  halloween  | 2
  headline1  | 1
  ---
 
  Any thoughts?


 GROUP BY headline and COUNT()
 =dn





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Select and count duplicates

2002-12-03 Thread Adolfo Bello
SELECT headline, count(*) AS HITS from your_table GROUP BY headline

 -Original Message-
 From: Michelle de Beer [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, December 03, 2002 8:27 AM
 To: mysql list
 Subject: Select and count duplicates
 
 
 I have a column containing headlines. In this column
 there are some duplicates, like this:
 ---
 monsters
 headline1
 monsters
 halloween
 monsters
 halloween
 ...
 --
 
 How can I get a result like this instead?
 HEADLINE   | HITS
 ---
 monsters   | 3
 halloween  | 2
 headline1  | 1
 ---
 
 Any thoughts?
 // Michelle
 
 Sql query
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now. 
http://mailplus.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: Select and count duplicates

2002-12-03 Thread Victoria Reznichenko
Michelle,
Tuesday, December 03, 2002, 2:27:00 PM, you wrote:

MdB I have a column containing headlines. In this column
MdB there are some duplicates, like this:
MdB ---
MdB monsters
MdB headline1
MdB monsters
MdB halloween
MdB monsters
MdB halloween
MdB ...
MdB --

MdB How can I get a result like this instead?
MdB HEADLINE   | HITS
MdB ---
MdB monsters   | 3
MdB halloween  | 2
MdB headline1  | 1
MdB ---

SELECT headline, COUNT(*) as hits FROM table_name GROUP BY headline



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Select and count duplicates

2002-12-03 Thread David Shapiro


Run this query as rs1:
select distinct scary_words from monsters_table; 

String word;
String query;
Int count;

while rs1.next() {
word = rs1.getString();
// Run this sql query as rs2
query = 'select count(*) from monster_table where scary_words=' +
word + '';

.
.
.
while rs2.next() {
// display your results (i.e., word count)


Use it to count them:
for
select count(*) 

-Original Message-
From: Michelle de Beer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 7:27 AM
To: mysql list
Subject: Select and count duplicates


I have a column containing headlines. In this column
there are some duplicates, like this:
---
monsters
headline1
monsters
halloween
monsters
halloween
...
--

How can I get a result like this instead?
HEADLINE   | HITS
---
monsters   | 3
halloween  | 2
headline1  | 1
---

Any thoughts?
// Michelle

Sql query

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Select and count duplicates

2002-12-03 Thread Roger Baklund
* Michelle de Beer 
 I have a column containing headlines. In this column
 there are some duplicates, like this:
 ---
 monsters
 headline1
 monsters
 halloween
 monsters
 halloween
 ...
 --
 
 How can I get a result like this instead?
 HEADLINE   | HITS
 ---
 monsters   | 3
 halloween  | 2
 headline1  | 1
 ---

This is a basic GROUP BY query:

SELECT headline, count(*) hits 
  FROM headlinetable
  GROUP BY headline
  ORDER BY hits DESC

URL: http://www.mysql.com/doc/en/SELECT.html 
URL: http://www.mysql.com/doc/en/Group_by_functions.html 

HTH,

-- 
Roger

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Select and count duplicates

2002-12-03 Thread Victor Pendleton
select distinct(headlines), count(headlines)
from table
group by headlines


-Original Message-
From: David Shapiro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 8:40 AM
To: 'Michelle de Beer'; mysql list
Subject: RE: Select and count duplicates




Run this query as rs1:
select distinct scary_words from monsters_table; 

String word;
String query;
Int count;

while rs1.next() {
word = rs1.getString();
// Run this sql query as rs2
query = 'select count(*) from monster_table where scary_words=' +
word + '';

.
.
.
while rs2.next() {
// display your results (i.e., word count)


Use it to count them:
for
select count(*) 

-Original Message-
From: Michelle de Beer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 7:27 AM
To: mysql list
Subject: Select and count duplicates


I have a column containing headlines. In this column
there are some duplicates, like this:
---
monsters
headline1
monsters
halloween
monsters
halloween
...
--

How can I get a result like this instead?
HEADLINE   | HITS
---
monsters   | 3
halloween  | 2
headline1  | 1
---

Any thoughts?
// Michelle

Sql query

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php