I'm using PHP with Mysqli and I'm trying to avoid duplicated results from the Database. However, the count result is different from these two very similar code. I'ts the first time I'm using DISTINCT, so I would like to know what's causing the difference. Thank you!
Ps: I saw similar question but the sql command is different.
Count: 83
SELECT DISTINCT (`email`) `id`,`name`,`email`,`sent`,`datasent`
FROM $dbtable_requests
WHERE `datasent`>'$datedb'
AND category = '$cat'
ORDER BY `name`
Count: 77
SELECT DISTINCT (`email`) `id`
FROM $dbtable_requests
WHERE `datasent`>'$datedb'
AND category='$cat_q'