calande Posted July 5, 2007 Share Posted July 5, 2007 I'm reading this page about SQL Aliases: http://www.w3schools.com/sql/sql_alias.aspAny idea for what SQL aliases are used? Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted July 5, 2007 Share Posted July 5, 2007 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 More sharing options...
calande Posted July 5, 2007 Author Share Posted July 5, 2007 Thanks for the explanation Link to comment Share on other sites More sharing options...
aspnetguy Posted July 6, 2007 Share Posted July 6, 2007 In asp.net you can bind an sql statement to a grid control and it uses the column names as grid headers so I use aliases to make the headers I want. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.