Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Unanswered: Combining 3 scripts

    I use 3 separate scripts to determine a users USERID and ACCESS.

    There are 3 tables, all with only a USERID and ACCESS field. Name the Tables A, B, C.

    Problem is, nobody will have all 3, sometimes 2, but mostly only 1. I tried to join the scripts, but they would come up blank...I assume because of the absence of data on 1 or 2 of the tables.

    Is there a way to run a merged script that would show which ACCESS members have? The USERID's would match on all 3 tables.

    Here is what I tried:

    select * from A, B, C where A.OPRID=B.OPRID and A.OPRID=C.OPRID AND A.OPRID = '&USERID';

    Please be kind, I am a novice, and I tried finding this on here, but couldn't find anything that made any sense to me......

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    select * from A where A.OPRID = '&USERID'
    union
    select * from B where B.OPRID = '&USERID'
    ...
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Feb 2010
    Posts
    2
    Thanks Nick, that worked.

    Now, is there a way to tell which table it was drawn from?

    All 3 tables are named for their type access, so the only way I know what type access they have is to know which table it was drawn from.

    Hope that makes sense.....

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >All 3 tables are named for their type access
    Do you mean to say the access types are A, B, & C?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by BradH View Post
    Now, is there a way to tell which table it was drawn from?
    select 'Type A', A.* from A where A.OPRID = '&USERID'
    ...
    ---
    "It does not work" is not a valid problem 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
  •