A
Andy Levy
Hi, apologies for the previous accidental post.
I currently have a table with the following values
ID Value GroupValue
1 10 50
1 10 50
1 10 50
1 10 50
1 10 50
2 6 18
2 6 18
2 6 18
3 87 87
4 2 10
4 6 10
4 2 10
As you can see each record has a Group ID number, and a value. Each record
also holds the total value of the group(GroupValue). I would like to design
an sql statement that will check if any records exist where the GroupValue
does not equal the total of all the Group's values.
I hope you get the gist.
I came up with the following statement - but it does not seem to work ....
SELECT ID, Value, GroupValue FROM myTable
WHERE (myTable.GroupValue <> (SELECT Sum(myTable.Value) AS SumValue FROM
myTable)
GROUP BY myTable.ID
Thanks
Andy
I currently have a table with the following values
ID Value GroupValue
1 10 50
1 10 50
1 10 50
1 10 50
1 10 50
2 6 18
2 6 18
2 6 18
3 87 87
4 2 10
4 6 10
4 2 10
As you can see each record has a Group ID number, and a value. Each record
also holds the total value of the group(GroupValue). I would like to design
an sql statement that will check if any records exist where the GroupValue
does not equal the total of all the Group's values.
I hope you get the gist.
I came up with the following statement - but it does not seem to work ....
SELECT ID, Value, GroupValue FROM myTable
WHERE (myTable.GroupValue <> (SELECT Sum(myTable.Value) AS SumValue FROM
myTable)
GROUP BY myTable.ID
Thanks
Andy