I am trying to apply COUNT() in a query and I have it working like so:
$sql = "SELECT id, Title, images, recdate, 'item' AS type FROM ads_list WHERE to_days(now())<=(to_days(recdate)+14)";
I've tried:
1. $sql = "SELECT id, Title, images, recdate, 'item' AS type COUNT(*) FROM ads_list WHERE to_days(now())<=(to_days(recdate)+14)";
2. $sql = "SELECT COUNT(*) id, Title, images, recdate, 'item' AS type FROM ads_list WHERE to_days(now())<=(to_days(recdate)+14)";
3. $sql = "SELECT COUNT(id), Title, images, recdate, 'item' AS type FROM ads_list WHERE to_days(now())<=(to_days(recdate)+14)";
4. $sql = "SELECT id, Title, images, recdate, 'item' AS type FROM ads_list WHERE to_days(now())<=(to_days(recdate)+14) COUNT(*)";
What am I doing wrong?
GROUP BYstatement as well if you useCOUNT. What are you trying to do?