Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having on calculated field
Message
 
 
To
15/07/2011 10:21:43
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01518229
Message ID:
01518234
Views:
41
>FWIW, I got this to work:
>
>
select 1 
>	from ClaimItems inner join Claims on cit_clmfk = clm_pk
>	where dbo.claimitemstatus(clm_forwarded
>				,cit_received
>				,(select com_overduedays
>				from companies
>					inner join Clients on cli_comfk = com_pk
>					inner join Claims subclaims on clm_clifk = cli_pk
>				where subclaims.clm_pk = claims.clm_pk)) = 3
This is absolutely not readable query.

I was trying to fix your query in the meantime (when you replied) using CROSS APPLY, but I think your query should be a simple query with JOINS and then select with the restriction from derived table. Can you please explain this query in English, I'll write a better version?

BTW, using Scalar functions in WHERE clause will make your query suffer from performance.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform