Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Digital Lifestyle
Web Design and Hosting
long shot: php mysql column represent query?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gort" data-source="post: 173253" data-attributes="member: 5540"><p>Here's an example:</p><p></p><p>we have two tables, one is called job_categories which has two columns:</p><p>job_category_id (integer, primary key, auto increment)</p><p>job_category_title (title of the job category)</p><p></p><p>second table is titled jobs, which is a list of jobs. One of the columns is job_category_id to correspond to the category it belongs in. Say we want to get a query that will list each job category title individually, and then how many jobs exist in the jobs table with that category_id. i.e</p><p></p><p>Architecture (3)</p><p>Human Resources (8)</p><p>Information Technology (0)</p><p>Miscellaneous (19)</p><p></p><p>Is there any way to do that query without having to do a count query individually on each row returned in some sort of a loop? I don't have any of my SQL books here (I'm at home with the family for Christmas, brought the powerbook with me). </p><p></p><p>I know it's a long shot asking here, but if anyone can offer a suggestion or point me to a better forum please let me know!</p></blockquote><p></p>
[QUOTE="gort, post: 173253, member: 5540"] Here's an example: we have two tables, one is called job_categories which has two columns: job_category_id (integer, primary key, auto increment) job_category_title (title of the job category) second table is titled jobs, which is a list of jobs. One of the columns is job_category_id to correspond to the category it belongs in. Say we want to get a query that will list each job category title individually, and then how many jobs exist in the jobs table with that category_id. i.e Architecture (3) Human Resources (8) Information Technology (0) Miscellaneous (19) Is there any way to do that query without having to do a count query individually on each row returned in some sort of a loop? I don't have any of my SQL books here (I'm at home with the family for Christmas, brought the powerbook with me). I know it's a long shot asking here, but if anyone can offer a suggestion or point me to a better forum please let me know! [/QUOTE]
Verification
Post reply
Forums
Digital Lifestyle
Web Design and Hosting
long shot: php mysql column represent query?
Top