best way to build a query
i have a table with all records that people say about a product for example
field: id , date, comment, product_owner_id
imagine that i have 100 records of comment for a product and 250 for other product and none for other product and now i want say that:
owner 1 have:
-product 1 have 100 records
-product 2 have 250 records
-product 3 have 0 records
owner 2 have:
-product 1 have 0 records
-product 2 have 0 records
-product 3 have 110 records
and so long, there is a way to build a simple query that donīt spend very resource of cpu? the db that i using is mysql
thanks a lot for your help
An output of 0 would be difficult insofar as those records don't exist. I suppose you could check to see if there was a return, and if not, programmatically list them as 0.
Anyway, for those records that do exist, try
SELECT product_owner_id, id, COUNT(*)
GROUP BY product_owner_id, id
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
thanks a lot for your help this works lilke i wanted
i have more one question that may be this place is not the best...
imagine this: you have a list of items and want check the items that you liked and them when you select/unselect the items they are saved in real time into mysql db i have see same like this working with cookies and not for all browsers i have see other way to do this not save but get the value without submit or reload the page any one know how can i do that?
the ideia is save a value of a checkbox for example when i check/uncheck them when i want consult the items that i have checked they will prompt a list that is saved in db
thanks for your help
By peljo in forum Database
Last Post: 12-17-2007, 11:38 AM
By lightningtechie in forum Database
Last Post: 02-07-2006, 08:34 AM
By Kyle Alons in forum java.announcements
Last Post: 04-28-2003, 09:36 AM
By ganesh in forum Database
Last Post: 12-10-2001, 10:57 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL