Trouble joining 3 tables

Discussion in 'ASP .Net' started by JJ297, Aug 24, 2007.

  1. JJ297

    JJ297 Guest

    I'm getting incorrect syntax error. Can someone tell me what I'm
    doing wrong, here's my stored procedure:



    select Titles.Title

    >From Titles


    Inner Join Titleclassification on classifications.classificationid =
    titleclassification.classificationid
    Inner Join titlecassification.titleid = titles.titleid
     
    JJ297, Aug 24, 2007
    #1
    1. Advertising

  2. JJ297

    Steve Guest

    Try this:

    select Titles.Title
    From Titles
    Inner Join Titleclassification on classifications.classificationid =
    titleclassification.classificationid
    and titlecassification.titleid = titles.titleid


    Steve C.
    MCAD,MCSE,MCP+I,CNE,CNA,CCNA


    JJ297 wrote:
    > I'm getting incorrect syntax error. Can someone tell me what I'm
    > doing wrong, here's my stored procedure:
    >
    >
    >
    > select Titles.Title
    >
    >>From Titles

    >
    > Inner Join Titleclassification on classifications.classificationid =
    > titleclassification.classificationid
    > Inner Join titlecassification.titleid = titles.titleid
    >
     
    Steve, Aug 24, 2007
    #2
    1. Advertising

  3. JJ297

    JJ297 Guest

    On Aug 24, 2:12 pm, Steve <> wrote:
    > Try this:
    >
    > select Titles.Title
    > From Titles
    > Inner Join Titleclassification on classifications.classificationid =
    > titleclassification.classificationid
    > and titlecassification.titleid = titles.titleid
    >
    > Steve C.
    > MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >
    >
    >
    > JJ297 wrote:
    > > I'm getting incorrect syntax error. Can someone tell me what I'm
    > > doing wrong, here's my stored procedure:

    >
    > > select Titles.Title

    >
    > >>From Titles

    >
    > > Inner Join Titleclassification on classifications.classificationid =
    > > titleclassification.classificationid
    > > Inner Join titlecassification.titleid = titles.titleid- Hide quoted text -

    >
    > - Show quoted text -


    Almost now I'm getting:

    The column prefix 'classifications' does not match with a table name
    or alias name used in the query.

    select Titles.Title
    >From Titles

    Inner Join Titleclassification on classifications.classificationid =
    titleclassification.classificationid
    and titleclassification.titleid = titles.titleid

    Any ideas?
     
    JJ297, Aug 24, 2007
    #3
  4. JJ297

    Steve Guest

    oops, how about this:

    select Titles.Title
    From Titles
    Inner Join titlecassification on titlecassification.titleid = titles.titleid
    Inner Join classifications on classifications.classificationid =
    titleclassification.classificationid


    Steve C.
    MCAD,MCSE,MCP+I,CNE,CNA,CCNA


    JJ297 wrote:
    > On Aug 24, 2:12 pm, Steve <> wrote:
    >> Try this:
    >>
    >> select Titles.Title
    >> From Titles
    >> Inner Join Titleclassification on classifications.classificationid =
    >> titleclassification.classificationid
    >> and titlecassification.titleid = titles.titleid
    >>
    >> Steve C.
    >> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >>
    >>
    >>
    >> JJ297 wrote:
    >>> I'm getting incorrect syntax error. Can someone tell me what I'm
    >>> doing wrong, here's my stored procedure:
    >>> select Titles.Title
    >>> >From Titles
    >>> Inner Join Titleclassification on classifications.classificationid =
    >>> titleclassification.classificationid
    >>> Inner Join titlecassification.titleid = titles.titleid- Hide quoted text -

    >> - Show quoted text -

    >
    > Almost now I'm getting:
    >
    > The column prefix 'classifications' does not match with a table name
    > or alias name used in the query.
    >
    > select Titles.Title
    >>From Titles

    > Inner Join Titleclassification on classifications.classificationid =
    > titleclassification.classificationid
    > and titleclassification.titleid = titles.titleid
    >
    > Any ideas?
    >
     
    Steve, Aug 24, 2007
    #4
  5. JJ297

    JJ297 Guest

    On Aug 24, 2:34 pm, Steve <> wrote:
    > oops, how about this:
    >
    > select Titles.Title
    > From Titles
    > Inner Join titlecassification on titlecassification.titleid = titles.titleid
    > Inner Join classifications on classifications.classificationid =
    > titleclassification.classificationid
    >
    > Steve C.
    > MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >
    >
    >
    > JJ297 wrote:
    > > On Aug 24, 2:12 pm, Steve <> wrote:
    > >> Try this:

    >
    > >> select Titles.Title
    > >> From Titles
    > >> Inner Join Titleclassification on classifications.classificationid =
    > >> titleclassification.classificationid
    > >> and titlecassification.titleid = titles.titleid

    >
    > >> Steve C.
    > >> MCAD,MCSE,MCP+I,CNE,CNA,CCNA

    >
    > >> JJ297 wrote:
    > >>> I'm getting incorrect syntax error. Can someone tell me what I'm
    > >>> doing wrong, here's my stored procedure:
    > >>> select Titles.Title
    > >>> >From Titles
    > >>> Inner Join Titleclassification on classifications.classificationid =
    > >>> titleclassification.classificationid
    > >>> Inner Join titlecassification.titleid = titles.titleid- Hide quoted text -
    > >> - Show quoted text -

    >
    > > Almost now I'm getting:

    >
    > > The column prefix 'classifications' does not match with a table name
    > > or alias name used in the query.

    >
    > > select Titles.Title
    > >>From Titles

    > > Inner Join Titleclassification on classifications.classificationid =
    > > titleclassification.classificationid
    > > and titleclassification.titleid = titles.titleid

    >
    > > Any ideas?- Hide quoted text -

    >
    > - Show quoted text -


    PERFECT! I see you added the word inner join twice. I get it now.
    Thanks!
     
    JJ297, Aug 24, 2007
    #5
  6. JJ297

    Steve Guest

    Great!

    You specify "INNER JOIN" for each table you want to perform the inner
    join on, and use the "<table.column>=<table.column>" notation for each
    one so SQL knows how to match up the rows. This applies for Left and
    Right joins, too.


    Steve C.
    MCAD,MCSE,MCP+I,CNE,CNA,CCNA


    JJ297 wrote:
    > On Aug 24, 2:34 pm, Steve <> wrote:
    >> oops, how about this:
    >>
    >> select Titles.Title
    >> From Titles
    >> Inner Join titlecassification on titlecassification.titleid = titles.titleid
    >> Inner Join classifications on classifications.classificationid =
    >> titleclassification.classificationid
    >>
    >> Steve C.
    >> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >>
    >>
    >>
    >> JJ297 wrote:
    >>> On Aug 24, 2:12 pm, Steve <> wrote:
    >>>> Try this:
    >>>> select Titles.Title
    >>>> From Titles
    >>>> Inner Join Titleclassification on classifications.classificationid =
    >>>> titleclassification.classificationid
    >>>> and titlecassification.titleid = titles.titleid
    >>>> Steve C.
    >>>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
    >>>> JJ297 wrote:
    >>>>> I'm getting incorrect syntax error. Can someone tell me what I'm
    >>>>> doing wrong, here's my stored procedure:
    >>>>> select Titles.Title
    >>>>> >From Titles
    >>>>> Inner Join Titleclassification on classifications.classificationid =
    >>>>> titleclassification.classificationid
    >>>>> Inner Join titlecassification.titleid = titles.titleid- Hide quoted text -
    >>>> - Show quoted text -
    >>> Almost now I'm getting:
    >>> The column prefix 'classifications' does not match with a table name
    >>> or alias name used in the query.
    >>> select Titles.Title
    >>> >From Titles
    >>> Inner Join Titleclassification on classifications.classificationid =
    >>> titleclassification.classificationid
    >>> and titleclassification.titleid = titles.titleid
    >>> Any ideas?- Hide quoted text -

    >> - Show quoted text -

    >
    > PERFECT! I see you added the word inner join twice. I get it now.
    > Thanks!
    >
     
    Steve, Aug 24, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    joining tables or view

    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Jul 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    358
    =?Utf-8?B?TWlrZSBNb29yZQ==?=
    Jul 7, 2005
  2. Peter Bassett
    Replies:
    3
    Views:
    947
    Augustus
    Aug 15, 2003
  3. AVL

    joining two tables

    AVL, Jul 22, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    343
    Christiano Donke
    Jul 23, 2008
  4. Peter

    Joining tables from 2 datasets

    Peter, Jun 6, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    410
    Peter
    Jun 8, 2009
  5. Artur Niesporek

    joining 3 tables in dataset

    Artur Niesporek, Apr 2, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    284
    Jeffrey Tan[MSFT]
    Apr 9, 2004
Loading...

Share This Page