Simple Query

  • Hi everyone

    I'm having trouble with a simple query - maybe one of you can help me.

    I have a table RSACCOUNTS with client info in it.  Data looks a bit like this

    ACCOUNTID | LEVEL1ACCOUNT | ACCOUNTCODE | COMPANYNAME

    9               | 9                      | 000009           | Main Company Name

    49             | 9                      | 01                  | Sub Division for Main Company

    50               | 9                      | 02                | Sub Division for Main Company

    I need to query this table and get these three companies by simply supplying the ACCOUNTCODE (000009).

  • SELECT *

    FROM RSAccouts A

    WHERE A.Level1Account = (

            SELECT A1.Level1Account

            FROM RSAccouts A1

            WHERE A1.AccountCode = '000009'

        )

     

  • Dude you're a legend, thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply