Re: Get lines matching a select / group by query

2004-09-21 Thread Alexander Newald
- Original Message - 
From: "Wesley Furgiuele" <[EMAIL PROTECTED]>
To: "Alexander Newald" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, September 21, 2004 1:41 AM
Subject: Re: Get lines matching a select / group by query


Use COUNT():
SELECT COUNT( id ) FROM test WHERE LEFT( id, 5 ) = '12345' GROUP BY value;
Wes
Hello,
unfortunately that is what I tried (I didn't posted my query correctly as I 
didn't use cut and past - sorry)

It will return the count of lines for each pairs of "group by"
Alexander Newald

On Tue, 21 Sep 2004 00:24:33 +0200, Alexander Newald
<[EMAIL PROTECTED]> wrote:
Hello,
I like to get the number of lines returned by a select ... group by 
query:

Example:
SELECT id FROM test WHERE LEFT(id,5) = "12345" GROUP BY value;
Perhaps I will get
+---+
| id|
+---+
| 2 |
| 1 |
| 5 |
+---+
3 rows in set (0.02 sec)
But I like to simply get 3
As I use mySQL 3.x and can't change it for now I'm not able to use
"FOUND_ROWS()"
Thanks,
Alexander Newald
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: 
http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Get lines matching a select / group by query

2004-09-20 Thread Wesley Furgiuele
Use COUNT():

SELECT COUNT( id ) FROM test WHERE LEFT( id, 5 ) = '12345' GROUP BY value;

Wes



On Tue, 21 Sep 2004 00:24:33 +0200, Alexander Newald
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I like to get the number of lines returned by a select ... group by query:
> 
> Example:
> 
> SELECT id FROM test WHERE LEFT(id,5) = "12345" GROUP BY value;
> 
> Perhaps I will get
> 
> +---+
> | id|
> +---+
> | 2 |
> | 1 |
> | 5 |
> +---+
> 3 rows in set (0.02 sec)
> 
> But I like to simply get 3
> 
> As I use mySQL 3.x and can't change it for now I'm not able to use
> "FOUND_ROWS()"
> 
> Thanks,
> 
> Alexander Newald
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
> 
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Get lines matching a select / group by query

2004-09-20 Thread Alexander Newald
Hello,
I like to get the number of lines returned by a select ... group by query:
Example:
SELECT id FROM test WHERE LEFT(id,5) = "12345" GROUP BY value;
Perhaps I will get
+---+
| id|
+---+
| 2 |
| 1 |
| 5 |
+---+
3 rows in set (0.02 sec)
But I like to simply get 3
As I use mySQL 3.x and can't change it for now I'm not able to use 
"FOUND_ROWS()"

Thanks,
Alexander Newald 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]