Results 1 to 6 of 6

Thread: [RESOLVED] [2005] SQL Syntax

  1. #1

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Resolved [RESOLVED] [2005] SQL Syntax

    I'm trying to select info from multiple tables and this isn't working:
    Code:
    "SELECT distinct Production.API " _
                    & "FROM (well_header JOIN production)" _
                    & "WHERE Not production.api = well_header.api" _
                    & "ORDER BY Production.API;"
    I originally had this because I know that it does work for sure but when I put it in VB, I get a syntax error stating the join isn't correct but it works when I execute it from Access

    Code:
    "SELECT distinct Production.API " _
                    & "FROM (well_header, production)" _
                    & "WHERE Not production.api = well_header.api" _
                    & "ORDER BY Production.API;"
    Any ideas anybody??
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] SQL Syntax

    Moved to Database Development

    Are you trying to select something from one table that IS NOT in another table?

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [2005] SQL Syntax

    Is this what you are tring?

    Select Production.API From Production Where Production.API Not In (Select well_header.api From Well_Header) Order By Production.API
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] SQL Syntax

    Yes, I'm trying to select data that is in the Production table but not in the wellHeader table
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] SQL Syntax

    Gary went in the direction I was intending to go. Have you tried his suggestion?

  6. #6

    Thread Starter
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    Re: [2005] SQL Syntax

    Thanks Gary! That worked
    Using Visual Studio 2008

    Please mark your thread RESOLVED if you no longer need help.

Posting Permissions

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



Click Here to Expand Forum to Full Width