monkeytooth Posted January 5, 2010 Share Posted January 5, 2010 $stage2check_query = "SELECT DISTINCT ISBN13, ISBN10, Title, Author COUNT(*) AS stage2check_rows FROM book WHERE $qStringType LIKE '%$qString%'"; I am trying to put together a query that will give me a distinct count of the database, there is something like 16,000,000 records in the DB, most doubles tripples etc.. of them there is maybe 200,000 unique roughly so I am trying to count that. The above line kicks back a error about not using proper syntax or something to the effect there of, specific to that line. Where did I mess this up? anyone? Link to comment https://forums.phpfreaks.com/topic/187302-php-mysql-and-distinct/ Share on other sites More sharing options...
The Little Guy Posted January 5, 2010 Share Posted January 5, 2010 your missing a comma after Author... Link to comment https://forums.phpfreaks.com/topic/187302-php-mysql-and-distinct/#findComment-989123 Share on other sites More sharing options...
monkeytooth Posted January 5, 2010 Author Share Posted January 5, 2010 Alright that fixed the count issue, now Im trying to do similar in the form of displaying results, but I can't get it to pull up everything in any given row.. I can only get it to pull one column of data from any given row. I need to pull all the data from the rows its finding as distinct, I tried $display_query = "SELECT DISTINCT(*) $qStringType FROM book WHERE $qStringType LIKE '%$qString%' LIMIT 40"; Which doesnt work, and I have tried various varations of it still no sucsess, is it possible to actually pull a full row and not just a column there of? Link to comment https://forums.phpfreaks.com/topic/187302-php-mysql-and-distinct/#findComment-989177 Share on other sites More sharing options...
The Little Guy Posted January 6, 2010 Share Posted January 6, 2010 You need to have an order by clause $stage2check_query = "SELECT DISTINCT ISBN13, ISBN10, Title, Author, COUNT(*) AS stage2check_rows FROM book WHERE $qStringType LIKE '%$qString%' ORDER BY ISBN13 DESC"; Link to comment https://forums.phpfreaks.com/topic/187302-php-mysql-and-distinct/#findComment-989341 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.