Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8088

Re: Dynamic JOIN Path

$
0
0

Try this.

 

Need to create a derive table.

 

Select measure from table_IS

Where ‘IS’ = Prompt(IS/WAS)

Union all

Select measure from table_was

Where ‘was’ = Prompt(IS/WAS)

 

 

  And create a measure using this derive table


below is the sample code:

Declare

@a asvarchar(4)

set @a='8-10'

select a1.ACT_ID, c1 from(

select  count(cs.ACT_ID)as ACT_ID,'2-4'as c1   FROM FACT TABLE cs

where cs.ACT_ID between 200000 and 400000


and'2-4'= @a

unionall

Selectcount(cs.ACT_ID)as ACT_ID,'8-10'as c1

FROM FACT TABLE cs where cs.ACT_ID between 800000 and 1000000

and'8-10'= @a)a1


Viewing all articles
Browse latest Browse all 8088

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>