RE: [PHP-DB] Weird Distinct bug?
| From: | Gurhan Ozen | Date: | Fri, 24 May 2002 13:37:17 +0000 |
| Subject: | RE: [PHP-DB] Weird Distinct bug? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19419@lists.php.net to get a copy of this message | ||
Hi Chris,
Try SELECT COUNT(DISTINCT(property_name)) .....
Gurhan
-----Original Message-----
From: Chris Payne [mailto:chris@planetoxygene.com]
Sent: Friday, May 24, 2002 6:28 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Weird Distinct bug?
Hi there everyone,
On my linux server I am using:
MySQL 3.22.32
Whereas on my Local server I am using
MySQL 3.23.42 (Or 43.don't remember).
Anyway, I am having a wierd but major problem, if I do the code like the
following locally it WORKS, if I do it on the server with the slightly old
MySQL it says there is an error, is this because it's not supported in that
version or does it need formatting slightly different?
$query = "SELECT * FROM llm WHERE property_name LIKE '%$property_name%' OR
country LIKE '%$property_name%' OR city LIKE '%$property_name%'
GROUP BY property_name ORDER BY property_name ASC LIMIT $offset,
$item_perpage";
$querytotal = "SELECT count(DISTINCT property_name) FROM llm WHERE
property_name LIKE '%$property_name%' OR country LIKE '%$property_name%' OR
city LIKE '%$property_name%'
ORDER BY property_name ASC";
The problem lies within SELECT COUNT (DISTINCT property_name) - locally, no
problem, works like a charm, but if I do it on the server it just says I
have an error in my statement and if I take out DISTINCT the error goes
away, it just then doesn't do what it needs to :-(
Any ideas? I don't know how to upgrade the MySQL on my server so I hope
there's another way around it :-(
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php