program to find the probability from the database

keerthi

New member
Joined
Mar 21, 2008
Messages
2
Programming Experience
Beginner
Hi, i am beginner to this vb.net.
I have created one database using vb.net in msaccess.that has three fields.let us say time,weather,drink.
I have entered data into this 20 times.
in time field either morning,afternoon,evening
in weather field hot, warm,cold
in drink field like coffee,tea,water,orange juice.

Now I am trying to find the probability from this database using vb.net.
like how many times the user takes coffee when it is morning and cold.
this is equal to

=total no of times the user takes coffee when it is morning and cold/total no of times it is morning and cold

can any explain me how to proceed to do this.i will be grateful if any one can tell me the procedure.

Thanking you
keerthi
 
SELECT
SUM(IIF(weather = 'cold' AND time = 'morning' AND drink = 'coffee', 1, 0)) / SUM(IIF(weather = 'cold' AND time = 'morning', 1, 0)) as coffe_prob
FROM
table
 

Latest posts

Back
Top