I have a database that includes jobs names and clients. I am querying and grouping by client name.
But I want to return results with the newest entries not oldest. THat way I will get the latest contact info for this client.
Here is an example:
Jobname client phone date
Job1 Bob 777-1000 Jan.1
Job2 Bob 666-6666 Jan.10
Job3 Chris 123-4567 Feb.8
Job4 Tom 555-5555 May.2
Job5 Jane 777-3333 July.4
Job6 Chris 999-9999 Jul.10
When I query I am getting the following results
Bob 777-1000
Chris 123-4567
Tom 555-5555
Jane 777-333
I want the newest data returned for Bob and Chris.
When I use fetch_assoc I get the oldest. What is simplest way to get the newest.
I am using:
$query_job = "SELECT client, contact1, job_id FROM job_list GROUP BY client";
$job = mysql_query($query_job, $db) or die(mysql_error());
$row_job = mysql_fetch_assoc($job);
Help!
3dron