sql server - SQL: Use table from table valued function -


i'm sure there better way of doing running same table valued function several times, there way table tvf once , run queries against set variables?

declare @runs int declare @won int declare @perc float  set @runs = (select count(*) tvf_horse_going('allow me', 'heavy')) set @won = (select count(*) tvf_horse_going('allow me', 'heavy') posnum = '1') set @perc = (@won * 100) / @runs  select @runs runs, @won won, @perc perc 

select     @runs = count(*),     @won = sum(case when posnum = 1 1 else 0 end) tvf_horse_going('allow me', 'heavy')  set @perc = (@won * 100) / @runs 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -