SQL Query Need Assistance with extending to query

Hi all,

I have using this sql query in php..

	$result = mysqli_query($con, "SELECT

		users.user_id AS users_user_id, 
		users.username AS users_username,

		venues.id AS venues_venue_id, 
		venues.user_id AS venues_user_id,
		statistics.id AS stats_id,
		statistics.venue_id AS stats_venue_id,
	  FROM users

	  INNER JOIN venues ON users.user_id = venues.user_id
	  INNER JOIN statistics ON venues.id = statistics.venue_id
      WHERE users.username='".$username."'

      LIMIT 1


Open in new window

It works find BUT I need the statistics results to be the last record. It's go the ID field which is set to auto so I guess that can be used.

So, the only thing I want to change is so the result on the statistics table is the last record added to the statistics table.

How can I do this please?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:

Replace {?} with the column name of the AUTO_INCREMENT key.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
error2013Author Commented:
Perfect! Thanks very much :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.