To save me describing the circumstances exactly I'll use a simple example that illustrates the problem.
Imagine a table called "rain" the columns are headed city, day1, day2......day365
In this table we record a yes or a no (-1 or 0) whether it rained in a particular city or town on that day of the year.
I want the user to be able to select the number from 1 to 365 and get a list of cities where it rained on that day.
A single SQL for day1 would look something like
SELECT Rain.city
FROM Rain
WHERE rain.day1=-1;
It is no biggy to write 365 queries like this using a mailmerge or similar program to change the last line to
WHERE rain.day2=-1;
WHERE rain.day3=-1;
etc
but I was wondering if there was some way to get the "day1" bit to come from a list. The user could then pick from that list something like day200 and the SQL would run using that field.
So far all I've come up with is either 365 queries or make a new table that is set up differently eg city, dayno, yes
Imagine a table called "rain" the columns are headed city, day1, day2......day365
In this table we record a yes or a no (-1 or 0) whether it rained in a particular city or town on that day of the year.
I want the user to be able to select the number from 1 to 365 and get a list of cities where it rained on that day.
A single SQL for day1 would look something like
SELECT Rain.city
FROM Rain
WHERE rain.day1=-1;
It is no biggy to write 365 queries like this using a mailmerge or similar program to change the last line to
WHERE rain.day2=-1;
WHERE rain.day3=-1;
etc
but I was wondering if there was some way to get the "day1" bit to come from a list. The user could then pick from that list something like day200 and the SQL would run using that field.
So far all I've come up with is either 365 queries or make a new table that is set up differently eg city, dayno, yes