I have Post code column and I want to get 60, 30 and 10% for each area code that I have, but the thing is there is a between statement which makes things a bit complicated. I need 60% from the first postcode then 30% from the second and 10% from the last postcode i.e these are the people I am trying to pull from each postcode. Here is my code below:
SELECT top 50000
id
,email
FROM fn_getsacilist ('knowblet,saciprofiled,govdata,tobydata',25000000,10,0)
WHERE idnumber>='66'
and idnumber<='98'
and (postcode between 2000 and 2199
or postcode between 4000 and 4099
or postcode between 7400 and 8099)
and income>=15000
Now to get results of a specific province then I would pull the data according to the postcodes like this postcode between 0001 and 2199 for instance.
But the request in my particular case is to pull the data in this manner:
JHB-60% // Cape Town-30% // Durban-10% and the only way to do this is by pulling the data by postcode as in my code above.