and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I am trying to make count of specific content in mysql database
For example: i want to make content menu and for each content i want to know how many headlines is in content.
Sports(15) // 15 headlines in content Sports
Politics(10) // 10 headlines in content Politics
Music(3) // 3 headlines in content Music
My database look like this:
[syntax="sql"]
CREATE TABLE headlines (
id INT NOT NULL auto_increment,
title TEXT NOT NULL,
text TEXT NOT NULL,
contid INT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE content(
contid int not null,
contentname text,
about text,
PRIMARY KEY(contid)
);
Do i make query for each content and then count it, or is there simpler way.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I think he knows it can be done that way. He just wants to know if he can do it in a single query. I don't know if that can be done or not, I'm waiting for someone more intelligent to reply