Results 1 to 3 of 3
Thread: Ordering by multiple columns
Jan 17, 2011, 09:41 #1
Ordering by multiple columns
Is it okay to order by the featured column as well as date_posted as I have done below?
SELECT jobs.job_title, companies.company_name, companies.company_url, companies.logo_thumbnail, jobs.job_url, jobs.job_salary, jobs.job_ote, jobs.job_perks, jobs.job_description, jobs.location, jobs.date_posted, industries.industry, job_types.job_type, count( applications.id ) AS applications, count( featured_jobs.id ) AS featured FROM jobs INNER JOIN companies ON companies.id = jobs.company_id INNER JOIN industries ON industries.id = jobs.industry INNER JOIN job_types ON job_types.id = jobs.job_type LEFT OUTER JOIN applications ON applications.job_id = jobs.id LEFT OUTER JOIN featured_jobs ON featured_jobs.job_id = jobs.id WHERE jobs.status = 'on' GROUP BY jobs.id ORDER BY featured DESC , date_posted DESC LIMIT 0 , 30
Jan 17, 2011, 09:49 #2
Did you try it?
Does it give an error?
Does it return the results you need?
"okay" is very vagueGuido - Community Team Leader
The Votes Are In: The Winners of the 2013 Community Awards are...
Blog - Free Flash Slideshow Widget
Jan 17, 2011, 09:50 #3
It does actually give the correct results just wanted to check that I am using the correct syntax.