Jump to content

SQL Alias?


calande

Recommended Posts

You need to use an alias if you are using an aggregate function like COUNT, MAX, etc.SELECT COUNT(id) AS num FROM tableYou would also use them if you are joining several tables with the same field names, or if you just don't want to type out the table name every time you use it.SELECT a.id AS a_id, a.name AS name, b.id AS b_id FROM table1 AS a, table2 AS b WHERE a.field1=b.field1

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...