Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 794099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:15:42+00:00 2026-05-14T22:15:42+00:00

I want to transfer the following statement to SubSonic 2.2 SELECT b.* FROM tableA

  • 0

I want to transfer the following statement to SubSonic 2.2

    SELECT b.*
    FROM tableA a
      INNER JOIN tableB b
        ON (a.year = b.year AND a.month = b.monath AND a.userid = b.userid);

My problem is that SubSonic’s SqlQuery.LeftInnerJoin() command has no overload which takes more than one column.

Since any join can be rewritten only using where clauses, I did the following in my sql:

    SELECT b.*
    FROM tableA a, tableB b
    WHERE a.year = b.year
      AND a.month = b.month
      AND a.userid = b.userid

which should deliver the same result (in fact, at least for mysql, there is logically absolutely no difference between these statements).

But I also got stuck transfering this to subsonic because the “IsEqualTo(…)” member is smart enough to figure out that my parameter is a string and puts it into quotes.

DB.Select("TableB.*")
  .From<TableA>()
  .From<TableB>()
  .Where(TableA.YearColumn).IsEqualTo("TableB.Year")
  .And(TableA.MonthColumn).IsEqualTo("TableB.Month")
  .And(TableA.UseridColumn).IsEqualTo("TableB.UserId")

(I tried different ways in setting the IsEqualTo parameter)

IsEqualTo(TableB.YearColumn)
IsEqualTo(TableB.YearColumn.QualifiedName)

Either the parameter is interpreted as

TableA.Year = 'TableB.Year'

or I get a SqlQueryException.

Can somebody tell me how to do this query with subsonic (Either the first – with JOIN or the second one)? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:15:42+00:00Added an answer on May 14, 2026 at 10:15 pm

    With SubSonic 2 out of the box you can’t.

    This said, you have the following alternatives:

    Extend SubSonic

    If you’re already familiar with SubSonic, you may consider to add multi-column joins to SubSonic itself.

    Use views, Stored procedures, table functions

    If you do not want to mess with SubSonics code, use views, stored procedures and/or table functions within sql server. SubSonic makes it easy to access data from views and stored procedures.

    Use an InlineQuery

    InlineQuery allows you to execute any sql – if it is an option to have bare sql in your code.

    Ugly workaround with InlineQuery

    If you absolutely want to create your query with SubSonic, you can try this:

    SqlQuery q = DB.Select()
      .From<TableA>()
      .CrossJoin<TableB>()
      .Where(TableA.YearColumn).IsEqualTo(0)
      .And(TableA.MonthColumn).IsEqualTo(0)
      .And(TableA.UseridColumn).IsEqualTo(0);
    

    Build the SQL statement, and replace the parameter names:

    string s = q.BuildSqlStatement();
    s = s.Replace(q.Constraints[0].ParameterName, TableB.YearColumn.QualifiedName);
    s = s.Replace(q.Constraints[1].ParameterName, TableB.MonthColumn.QualifiedName);
    s = s.Replace(q.Constraints[2].ParameterName, TableB.UserIdColumn.QualifiedName);
    

    Then use s with an InlineQuery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to transfer (send or receive) a hash from client to server.
Where does eclipse keep it's key-binding settings? I want to transfer them from one
I want to use Custom URL Scheme to transfer data from application to other
I am thinking of using following code, but I want to transfer hundreds of
I am using following reference to transfer files from assets folder to sd card
I want to transfer a data from one webpage to another page. But I
I want to transfer data between a smart phone app and a website. What
I want to transfer one asp.net page form values to another page when i
I want to transfer files between any 2 active users on my website and
I want to transfer files across the network using C or C++. What topics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.