Union and mysql_num_rows
Posted by:
Horng Ou
Date: October 28, 2011 11:16AM
Has anyone ever had the problem where in an UNION sql the query browser tells you a number of rows fetched and php's mysql_num_rows gives you a number that's double that?
I know UNION is supposed to get rid of duplicates, but that's the problem I am running into.
Here is the SQL.
SELECT sku, description, release_date, MATCH(sku, description) AGAINST ('television' IN BOOLEAN MODE) AS score FROM products WHERE MATCH (sku, description, release_date) AGAINST ('television' IN BOOLEAN MODE)
UNION
SELECT sku, description, release_date, '0' AS score FROM products WHERE (sku LIKE '%television%' OR description LIKE '%television%')
ORDER BY score, release_date desc, sku;
Subject
Written By
Posted
Union and mysql_num_rows
October 28, 2011 11:16AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.