Forum Moderators: open
I have a massive 2.5+ million listings and have managed to make the seacrh almost instant using MATCH in query...
I'm having a problem pulling back duplicates since they are listings in multiple categories.
I've tried DISTINCT and it works but I think I need to include all fields of the row because i'm returning false $var except those i include in sql like so...
$query = "SELECT DISTINCT bizName,bizAddr,locCounty,bizState
FROM biz_all
WHERE MATCH bizName AGAINST('".mysql_escape_string($keyword)."')
AND
bizState ='state'
ORDER BY bizName
LIMIT $offset, $rowsPerPage";
My main problem is I can't seem to get COUNT and DISTINCT working in same sql query...
$query = "SELECT DISTINCT bizName,bizAddr,locCounty,bizState
COUNT(bizID)
AS numrows
FROM biz_all
WHERE MATCH bizName AGAINST('".mysql_escape_string($keyword)."')
AND
bizState ='state'";
The count comes first for pagination...
Can someone please help me with correcting the sql query?
Thanks,
RD