var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
Sql Query Help
log parentid -> uploads parentid.
I want to list all uploads by how many views they have. that number, the number of views, is the count of entries that are in the log database that match the parentid of the upload.
How can i achieve this?
assuming 'name' as identifier for upload and 'id' as pkey for log
select uploads.name,COUNT(log.id) as 'views'
left join log on log.parentid=uploads.parentid
group by uploads.id
order by count(log.id) desc
Database design and performance optimization, custom PHP scripts, and publicly available resources for developers!
Whenever i try any GROUP BY in an sql command the server just keeps on loading and never stops, i have to kill the process manually, im not sure whats wrong.
Have you tried this on a small, controlled data set?
yes, even on a table with 2 rows it times out.
What's going on in your database error_log?
By Lord Northern in forum Programming Discussion
Last Post: 03-23-2008, 11:49 PM
By Goldfiles in forum Programming Discussion
Last Post: 12-28-2006, 11:16 PM
By orbitz in forum Programming Discussion
Last Post: 11-10-2005, 11:31 AM
By myself1982 in forum Dedicated Server
Last Post: 01-11-2005, 01:54 PM
By djwayne_2004 in forum Programming Discussion
Last Post: 01-05-2005, 05:58 PM