richrock Posted April 21, 2010 Share Posted April 21, 2010 Hi, I've got a query that's throwing up an error, really stuck why. It read right to me, but it's just not working. Its attempting to count all fields from a table with left joins as criteria for filtering.... SELECT COUNT(i.*) AS value FROM jos_yearbook_instruments i LEFT JOIN jos_yearbook_country co ON i.country_id = co.id LEFT JOIN jos_yearbook_city ci ON i.city_id = ci.id LEFT JOIN jos_yearbook_circa c ON i.circa_id = c.id LEFT JOIN jos_yearbook_makers m ON m.id = i.maker_id LEFT JOIN jos_yearbook_auctioneers a ON a.id = i.auctioneer_id Can anyone help? I tried i.id but that gave me an incorrect total... ? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 21, 2010 Share Posted April 21, 2010 It's hard to help when I don't know what you want the SQL to do. Quote Link to comment Share on other sites More sharing options...
richrock Posted April 21, 2010 Author Share Posted April 21, 2010 Gah! Me and my hurried typing - its simply supposed to count the total number of entries in a table, based on the left joins matching up (city is present in table, etc) phpmyadmin tells me when I count(*) I have ~25,500 results (rounding), yet running this in joomla tells me I have #77,000, quite a discrepancy. And phpmyadmin is correct. Quote Link to comment Share on other sites More sharing options...
richrock Posted April 21, 2010 Author Share Posted April 21, 2010 My bad - I don't know the difference between local and remote databases : Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.