SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast gecastill's Avatar
    Join Date
    May 2005
    Location
    Virginia US
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SELECT statement

    I am trying to assign a field value [say column_B] from another table [say table_B] to a column name [say column_A] that is part of the query result set of table_A.



    See example below.



    SELECT A.Product, A.Customer, A.Vendor, ProductManager = (SELECT B.user_desc FROM TABLE B WHERE user_name = 'gecastill'), A.LaunchDate FROM TABLE A



    How can I do that? I used to know how to do that but I have not done it in a year.



    Please advise, thanks
    Best Regards,
    Gibran E Castillo

  2. #2
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    698
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    The syntax is

    Code:
    SELECT A.Product, A.Customer, A.Vendor, 
    (SELECT B.user_desc 
        FROM TABLE B 
      WHERE user_name = 'gecastill') as ProductManager, 
     A.LaunchDate 
     FROM TABLE A

  3. #3
    SitePoint Enthusiast gecastill's Avatar
    Join Date
    May 2005
    Location
    Virginia US
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    swampBoogie,

    Thank you.
    Best Regards,
    Gibran E Castillo


Bookmarks

Posting Permissions

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