tags:

views:

155

answers:

1

Is it possible to do a join to a nested select statement in SubSonic 2.2? I am having trouble with this because I have to do a group by...

I.E.

select conn_company.company_name, SUM(t.quote_grand_total) as 'SUM' from conn_company 
    inner join 
    (SELECT *
     FROM [dbo].[QuoteDBAll]
     where [dbo].[QuoteDBAll].[quote_status_id] = 1
    AND [dbo].[QuoteDBAll].[quote_ca_modified_date] BETWEEN '12/1/2000' AND  '12/1/2009'
    ) t
    on conn_company.company_id = t.company_id
    group by company_name
    having  company_name = 'JACK'
+2  A: 

Unfortunately you're not going to be able to convert that SQL into SubSonic 2 syntax. I would suggest you create a sql view based on your query and get SubSonic to generate a model from that instead.

Adam
Either a view or a sproc.
John Sheehan
Thanks for the answers guys. Now I know I'm not completely stupid or crazy.I've actually decided to Group By in the dataset after it is returned:http://support.microsoft.com/kb/326145... and by that, I mean this:http://ureader.com/message/1468920.aspxI tried to access the CodingHorror Namespace but I couldn't get to it.
John