0

Hi,
I am working on a job module where i have to fetch company name having more jobs. like
abc 20 jobs
def 30 jobs
ghi 10 jobs
jkl 40 jobs


what i want to do, job order acc to job number like below
jkl 40 jobs
def 30 jobs
abc 20 jobs
ghi 10 jobs
thanks
NEED your suggestions

5
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by tomato.pgn
0

as far as my knowledge is concern.

create 2 tables
company and jobs
for every (primary key)"companyid" match in jobs table (foreign key) "companyid".
from their you can count how many jobs per company.

that is one-many relationship of database.

0

Try this idea.

<?php
// sql connection here

$query = mysql_query("select * from tbl_name order by number_of_jobs desc");
while($result=mysql_fetch_array($query))
{
   echo $result['company_name'];
   echo $result['number_of_jobs']."<br>";
}

?>
0

I don't know that whether i get your question correctly,but try this

select companyName ,count(companyName ) from company,jobs
where company.companyId=jobs.companyId
group by companyName 
order by count(companyName ) desc

Hope it helps... :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.