SubSonic Forums
All Your Database Are Belong To Us

Innerjoin with more than one column

Latest post 09-11-2008 10:13 AM by sarvagna. 4 replies.
  • 09-09-2008 7:46 PM

    Innerjoin with more than one column

    Im using subsonic 2.1

    I have 2 tables and i am joining them with 2 columns

    How do i do inner join in select query.

    to be more precise how do i do same with subsonic what im doing in below query.

    select * from table1 t1
    inner join table2 t2
    on t1.col1 = t2.col1 and t1.col2 = t2.col2

    thanks.

    SP

  • 09-10-2008 12:02 AM In reply to

    Re: Innerjoin with more than one column

    Try this I'm not sure if it will work

    new Select().From(Table1.Schema).InnerJoin(Table2.Col1Column, Table1. Col1Column).InnerJoin(Table2.Col2Column, Table1. Col2Column)

    If I am I because I am I, and You are You because You are You, then I am I, and you are you. But If I am I because You are You, and You are You because I am I, then I am not I and You are not You. -Rabbi of Kotzk

  • 09-10-2008 9:11 AM In reply to

    Re: Innerjoin with more than one column

    Thanks for your reply...

     I tried it.

    When I get sql statement using BuildSqlStatement() I get

    select * from table1
    inner join table2 on table1.col1= table2.col1
    inner join table2 on table1.col2= table2.col2

    which is incorrent.

    thanks

    SP

  • 09-10-2008 4:54 PM In reply to

    Re: Innerjoin with more than one column

    It looks like SubSonic's SqlQuery only supports joining on one column you can use InlineQuery :( or submit a patch that fixes this

    If I am I because I am I, and You are You because You are You, then I am I, and you are you. But If I am I because You are You, and You are You because I am I, then I am not I and You are not You. -Rabbi of Kotzk

  • 09-11-2008 10:13 AM In reply to

    Re: Innerjoin with more than one column

     thanks for your help.

    I will try to explore it. and if i have a solution, will let you know. meanwhile if anyone of you have a solution please post it.

    thanks

    sp.

Page 1 of 1 (5 items) | RSS