Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    Unanswered: Beginners question Aliased Columns

    Hi I'm having trouble in referring to an aliased column name in my query.

    SELECT 1 as v1, v1+1 as v2;

    Can anyone tell me how to do this please?

  2. #2
    Join Date
    Oct 2003
    Denver, Colorado

    Re: Beginners question Aliased Columns

    Try this instead:
    SELECT @v1:=1 as v1, @v1+1 as v2;
    This will assign the user variable @v1 the value of v1 for each record. I am not sure why you cannot refer to aliased columns within the column selection portion of the statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts