Select and COUNT

2007-06-08 Thread spacemarc
Hi all, I have this query: SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid This query shows only the users (tableA) that are in tableB with at least 1 record (like total) but not the users that have 0 record. How can I obtain all users

Re: Select and COUNT

2007-06-08 Thread Baron Schwartz
Hi spacemarc, spacemarc wrote: Hi all, I have this query: SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid This query shows only the users (tableA) that are in tableB with at least 1 record (like total) but not the users that have 0

Re: Select and COUNT

2007-06-08 Thread Baron Schwartz
-in-mysql/ I've inverted, like you said, the tables and used LEFT OUTER JOIN: SELECT tableA. * , COUNT( tableB.uid ) AS Tot FROM tableA LEFT OUTER JOIN tableB ON tableB.uid = tableA.uid GROUP BY tableA.uid and it works. I also tried this other: SELECT tableA.*, COUNT(tableB.uid) AS Tot FROM

RE: Select and COUNT

2007-06-08 Thread Jerry Schwartz
SELECT tableA.*, COUNT(*) AS Tot FROM tableB LEFT OUTER JOIN tableA ON tableA.uid=tableB.uid GROUP BY tableA.uid Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com

SELECT and count fields

2006-12-07 Thread spacemarc
Hi I have this select: SELECT tab1.field, tab2.field, tab3.field FROM table JOIN JOIN WHERE tab4.type=b GROUP BY etc ORDER BY etc Now, the tab4 has three fields: id, color, type. I want to select where type=b and to count all the occurrences of color in the same query. Example:

Select and count duplicates

2002-12-03 Thread 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

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

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

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

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

re: Select and count duplicates

2002-12-03 Thread Victoria Reznichenko
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

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

Re: Select and count duplicates

2002-12-03 Thread Roger Baklund
--- 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

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 and count

2002-01-11 Thread Pinky Thakkar
Hi, We have a transaction table that has a field called userid. Each time a user makes a purchase, this table get populated. I am using the following query to get the no of transactions per user: select userId, count(*) from transactions group by userid I am using the following query to get