Link to home
Start Free TrialLog in
Avatar of dkilby
dkilbyFlag for Canada

asked on

MS SQL + Percentage from List - Random

I am trying to create a view from a table  where the view is a percentage and random.

So the view always has 38% of the list in the table

ie:  select 38% of table where submitdate between '08/01/2015' and '08/30/2015' and CustomerScore < 7

But i want the 38% to be stored in another table so that value can adjust from month to month.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

and the question is?
Somewhat pedantic perhaps, sorry, but there is no actual question, just a series of statements.

I suspect you will need a function, not a view, for this.
& are you also expecting these to be flexible?
where submitdate between '08/01/2015' and '08/30/2015' and CustomerScore < 7
are these the only likely filtering conditions?

{+ edit}
oh, and can you expend on what you mean by random?
for example, do you mean, that the 38% any be any percentage (0 to 100)
or, do you mean, the rows returned to meet the 38% are randomly chosen
Avatar of dkilby

ASKER

I want to pull back 38% of the rows that meet the criteria of

where submitdate between '08/01/2015' and '08/30/2015' and CustomerScore < 7

and the questions is this possible and if so how would the query look ?

thanks
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dkilby

ASKER

Thank you