For VB, use excel, and the help documentation in Excel (It's got a FULL VB implementation and help files right there)
As for the SQL, you need to do what? Count how many yesses there are within a given year? What if you get more than one yes on any given record/line? Do you count the yessses, or the records? Part of learning and writing sql is stating clearly *exactly* what you want, once you can do that, the SQL kind of follows of its own accord.
If you're counting records, then you could try the following:
Select count(*) from table where
year = 2005 AND
(yesno1 = 'yes' OR yesno2 = 'yes' OR yesno3 = 'yes' OR yesno4 = 'yes')
if you're counting how many yesses there are, then you need to get 4 separate values (SQL primarily deals with records, so your queries have to act at the same level) and add them up - which might be done using a compound satement, or some other technique, but it really depends on your table's structure, and whether it contains a primary key/unique identifier field.
Do the yes/nos contain the words 'yes' and 'no' or the values 0 and 1. If it were the vaules, you could simply add them up i.e.
select sum(yesno1 + yesno2 + yesno3 + yesno4) from table
where year = 2005
Which would be the easiest way of doing it.
I've not tried any of these out properly, but they ought to work out fine.
|