Results 1 to 3 of 3

Thread: SQL Question

  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL Question

    This forum is as close as I can get unless a post to Access might be fruitful. But here goes:

    I need some help writing what for me is a rather advanced SQL query. This is MS Trans-act SQL (SQL Server and Access 2000). I'm pulling names an addresses from several tables. If the address for a name is missing from the table, I need to go to another table to get the address info.

    I'm guessing I'll need to use the IF EXIST statement. But is there an expert out there who can direct me to a *really* good resource to learn how to do this?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: SQL Question

    Do you have an equivalent query in ANSI SQL? It's a little hard to get specific without a specific question. It sounds like you need both tables in your query with a calculated field that gets its value from the second table if the value is null in the first. You shouldn't need a subquery to do that.

    As for resources, get O'Reilly's Transact-SQL Programming by Kevin Kline, Lee Gould & Andre Zanevsky (ISBN 1-56592-401-0).
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL Question

    Char,

    Thanks for the nudge. I'll explore some syntax based on your suggestion and post again if necessary.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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