2 Replies Latest reply: Dec 7, 2012 6:30 AM by Ewaver RSS

    SQL HELP

    Ewaver
      Hi,

      I know this is a simple questionf or you advanced SQL programmers, so I appreaciate you entertaining it.

      How can I add a concatenated column to an existing table with the following columns?

      Table Name: PRICE_BOOK
      COLUMN 1 = COUNTRY (Example USA)
      COLUMN 2 = ROLETITLE (EXAMPLE Manager)

      I've been trying use

      ALTER TABLE PRICE_BOOK
      SELECT COUNTRY || ROLETITLE AS COUNTRYROLE

      but I get an error

      I am using SQL commnads in Apex

      Really appreciate your help ;)
        • 1. Re: SQL HELP
          Scott
          Ewaver,

          You don't need to add a concatenated column to a table; rather, you can select two (or more) columns from the table and concatenate them in your SQL. You had the answer, it was just over-engineered.

          Simply issue this SQL from the SQL workshop to get what you're looking for:
          SELECT country || roletitle countryrole FROM price_book
          Hope this help!

          Thanks,

          - Scott -

          http://spendolini.blogspot.com
          http://www.enkitec.com

          Edited by: Scott on Dec 6, 2012 5:52 PM
          • 2. Re: SQL HELP
            Ewaver
            Thanks Scott :)