List:General Discussion« Previous MessageNext Message »
From:Richard Reina Date:December 27 2011 5:31pm
Subject:query question
View as plain text  
Hello All,

Hope everyone is having a wonderful holiday.  I have a table like:

|ID  |city    |ST  |memo|

I would like to write a query that somewhat randomly grabs a record for a
for a given city and state. I say randomly because what I'm specifically
after is that if city IS NOT NULL than I want it to grab a record for that
city count(*)/10 of the times.  So that if there are four records for
"Carmel", "IN" then a record that has city "Carmel" and ST "IN" will get
picked 40% of the time and record with "IN" and city="NULL" will get picked
60% of the time.  Is this possible in a query or do I need to write code
that will select a query?

Thanks you,

Richard Reina

query questionRichard Reina27 Dec