ASC LIMIT -- what's it do?

Hey guys, in the instance of the following code, I’m just curious as to what the ASC LIMIT part does:

SELECT * FROM photos ORDER BY date ASC LIMIT 1

Thanks for any help! :slight_smile:

Hi,

The ASC keyword actually belong to the ORDER BY clause and tells MySQL that the result should be sorted by date in an ascending order. LIMIT 1 tells MySQL that you only want the first row in the result.

Yours, Erik.

ASC means to order it “ascending” (in this case, starting from the oldest date to the newest). There’s also the opposite, DESC, which would sort it descending (newest to oldest).

LIMIT 1 tells MySQL to only return one result.

Edit:

Beaten!

Off Topic:

owned!!

Thank you guys, I appreciate the help. Man, who woulda figured that ASC represented “ascending” eh? :slight_smile: (clearly not me! lol)

:bawling: