"Martijn Tonies" <[EMAIL PROTECTED]> wrote on 11/11/2005 03:42:42 AM:
> > > > Does MySQL support: > > > > > > SELECT ID_TAG= ID > > > FROM TABLE > > > > > > rather than select ID TAG_ID from Table. I need this for MS SQL > > Compabilty. > > > > > > > > > > > > Within the SELECT statement you must use := If you were in a SET > > statement, you could use = or := > > > > http://dev.mysql.com/doc/refman/4.1/en/variables.html > > Shawn, I'm unsure if this is the same. > > In MS SQL, using the above construct defines a column alias. > > With regards, > > Martijn Tonies > Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL > Server > Upscene Productions > http://www.upscene.com > Database development questions? Check the forum! > http://www.databasedevelopmentforum.com > > Did you read the link? The OP wanted to know if MySQL supported the = sign in a SELECT statement. The documentaion I referred the OP to clearly differentiates the use of = and := within SELECT statements and SET statements for MySQL. If the MySQL behavior is not what they were hoping for then they are now informed that a form used in MS SQL to produce column aliases does not work the same way on MySQL platform and why it doesn't work that way. I don't think I could have explained it myself any better than what was already documented. Hence, the simple RTFM answer.... BTW -- the "SELECT ID TAG_ID,..." form works equally well on MS SQL to produce column aliases because it is ANSI compliant. From: "ISO/IEC 9075-2:2003 (E) 7.12 <query specification>" (a.k.a. SQL:2003's definition of the SELECT clause) --------------quote----------------------- <query specification> ::= SELECT [ <set quantifier> ] <select list> <table expression> <select list> ::= <asterisk> | <select sublist> [ { <comma> <select sublist> }... ] <select sublist> ::= <derived column> | <qualified asterisk> <qualified asterisk> ::= <asterisked identifier chain> <period> <asterisk> | <all fields reference> <asterisked identifier chain> ::= <asterisked identifier> [ { <period> <asterisked identifier> }... ] <asterisked identifier> ::= <identifier> <derived column> ::= <value expression> [ <as clause> ] <as clause> ::= [ AS ] <column name> <all fields reference> ::= <value expression primary> <period> <asterisk> [ AS <left paren> <all fields column name list> <right paren> ] <all fields column name list> ::= <column name list> --------------end quote----------------------- As you can see, there is no grammar for the "ALIAS=FIELDNAME" form supported by MS SQL. Aliases are not defined with the = symbol. <value expression>s can contain = signs. However if used un-aliased, the resulting column is the entire expression not just what is on the left-hand-side of the = sign in the expression. Once again, MS's inability to follow simple directions has created headaches for its users. Respectfully, Shawn Green Database Administrator Unimin Corporation - Spruce Pine