Hello,
I am trying to construct an sql statement that will insert a new row in to the frequency table containing the ball number, count statement to count how many times a particular ball has been drawn as a main ball, count statement to count how many times a particular ball has been draw as the bonus ball.
I have two tables with the following schema
Table Name: DrawResults
Fields
------
Draw Number - Integer
Date - Date
FirstBall - Number
Secondball - Number
ThirdBall - Number
ForthBall - Number
FifthBall - Number
SixthBall - Number
BonusBall - Number
Table Name: Frequency
Fields
------
Ball Number - Number
AsMainBall - Number
AsBonusBall - Number
My SQL is
INSERT INTO Frequency (BallNumber, AsMainBall, AsBonusBall)
Select 1, Count(*) FROM DrawResults Where (FirstBall = 1 or SecondBall = 1 or ThirdBall = 1 or ForthBall = 1 or FifthBall = 1 or SixthBall = 1), Count(*) FROM DrawResults Where BonusBall = 1)
But Access reports an error
"Number of query destination fields are not the same"
Please could someone tell me where I am going wrong.
Thanks
I am trying to construct an sql statement that will insert a new row in to the frequency table containing the ball number, count statement to count how many times a particular ball has been drawn as a main ball, count statement to count how many times a particular ball has been draw as the bonus ball.
I have two tables with the following schema
Table Name: DrawResults
Fields
------
Draw Number - Integer
Date - Date
FirstBall - Number
Secondball - Number
ThirdBall - Number
ForthBall - Number
FifthBall - Number
SixthBall - Number
BonusBall - Number
Table Name: Frequency
Fields
------
Ball Number - Number
AsMainBall - Number
AsBonusBall - Number
My SQL is
INSERT INTO Frequency (BallNumber, AsMainBall, AsBonusBall)
Select 1, Count(*) FROM DrawResults Where (FirstBall = 1 or SecondBall = 1 or ThirdBall = 1 or ForthBall = 1 or FifthBall = 1 or SixthBall = 1), Count(*) FROM DrawResults Where BonusBall = 1)
But Access reports an error
"Number of query destination fields are not the same"
Please could someone tell me where I am going wrong.
Thanks