Help with SELECT statement

#4
[eluser]jedd[/eluser]
[quote author="Samuurai" date="1248727669"]
There's a lot of short-hand in there though... why do you select t.* Does create some sort of alias?[/quote]

For readability, particularly until you get the hang of things you might want to avoid those shorthands. Even now I tend to avoid them unless I'm writing an especially wordy query.

Consider this segment of bgreene's statement:
Quote:select t.*,a.name as appname,d.name as devname from downtime t

The 'downtime t' at the end is where it's aliased, and there's a good case to be made for consistently using AS (even though it's technically optional, at least with MySQL). So I'd write downtime AS t there. I also upper-case all my reserved words, which I think further aids readability.


Messages In This Thread
Help with SELECT statement - by El Forum - 07-27-2009, 09:25 AM
Help with SELECT statement - by El Forum - 07-27-2009, 09:43 AM
Help with SELECT statement - by El Forum - 07-27-2009, 09:47 AM
Help with SELECT statement - by El Forum - 07-27-2009, 11:14 AM
Help with SELECT statement - by El Forum - 07-29-2009, 08:13 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:07 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:25 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:31 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:59 AM
Help with SELECT statement - by El Forum - 08-05-2009, 10:19 AM
Help with SELECT statement - by El Forum - 08-05-2009, 10:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.