Jump to content

information about selection code


ragekc

Recommended Posts

i have the folowing code:"SELECT LAST(codigocliente) AS highest_codigocliente FROM tblsorteio ORDER BY codigocliente";all that does(i think)...gets the last entry in the colum(codigocliente)...and the order by, orders them in onder from least to greatest...so codigo cliente = client code ... so it pulls out the last client registered in the DB ....i wanna know what does the part ... AS highest_codigocliente , do and do i need it in the code??w3schools said its an expression.. what is an expression??.. the resto of the code i understand.and one last thing .... if i can eliminate the ( AS highest_codigocliente ) how would the code look like??THANKS!!!!!!

Link to comment
Share on other sites

it is just 'renaming' the column.when you access it through your data array (Server Side Script) or it is displayed in your database program the column title will be highest_codigocliente instead of LAST(codigocliente)It is mostly for SQL Reports and such where you want hte output to look nice.

Link to comment
Share on other sites

You do can just delete that part, it would just validly look like this:

SELECT LAST(codigocliente) FROM tblsorteio ORDER BY codigocliente
But as aspnetguy said, the column then would be named (in the results) as "LAST(codigocliente)" :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...