Help with MySQL query
$250-750 USD
Dibayar semasa penghantaran
A very small task for an expert in SQL. I have two tables:
jobs - has details of jobs posted, including the location postcode
postcodes - holds all available postcodes
I want a sort facility that will allow users to sort by distance (from their location), salary, date, etc
I have the code that gets all the locations within the distance specified by the user:
select * from jobs where postcode in (select postcode from postcodes where distance < $distance)
'distance' is dynamically calculated:
$latitude = getLatitude($postcode);
$longitude = getLongitude($postcode);
$sql = "SELECT *,round((((acos(sin((".$latitude."*pi()/180))*sin((latitude*pi()/180))+cos((".$latitude."*pi()/180))*cos((latitude*pi()/180))";
$sql .= "*cos(((".$longitude."-longitude)*pi()/180))))*180/pi())*60*1.1515), 1) as distance FROM postcodes ";
$sql .= "HAVING distance <= $distance"
The problem is all sorting criteria are ignored; jobs are always sorted by the id (which is default MySQL).
Your job is basically fix the query so that sorting can be applied. You most probably will need to use join, but as an expert you will figure this our very quickly.
ID Projek: #1426602
Tentang projek
10 pekerja bebas membida secara purata $255 untuk pekerjaan ini
My objective is great customer service with broad experience and affordable Implementation. My Notion : "No Satisfaction, No Payment".
Aisomex & Animize Consultancy Services is an IT company providing hand crafted IT solutions for all kinds of business needs. Our major working heads are Web Tech, Software & Outsourcing. We concentrate on ASP.net and P Lagi