Windsailor
Well-known member
- Joined
- Aug 2, 2006
- Messages
- 45
- Programming Experience
- 1-3
I have one table that I want to pull data from it only if a ‘Bit’ column is true.
This applies to two similar instances in the same table.
So I created a UNION query to pull the desired data.
SELECT [Query1-1].ID, [Query1-1].A1, [Query1-1].ABit
FROM [Query1-1]
WHERE ((([Query1-1].ABit)=True));
UNION SELECT [Query1-2].ID, [Query1-2].B1, [Query1-2].BBit
FROM [Query1-2]
WHERE ((([Query1-2].BBit)=True));
The problem is that I want to add –or sum- the like columns (that have the same ID value) within that UNION statement…
ID A1 ABit
2 35 -1
3 41 -1
4 52 -1
4 62 -1
To make…
ID A1 ABit
2 35 -1
3 41 -1
4 114 -1
Am I going in the wrong direction here?
This applies to two similar instances in the same table.
So I created a UNION query to pull the desired data.
SELECT [Query1-1].ID, [Query1-1].A1, [Query1-1].ABit
FROM [Query1-1]
WHERE ((([Query1-1].ABit)=True));
UNION SELECT [Query1-2].ID, [Query1-2].B1, [Query1-2].BBit
FROM [Query1-2]
WHERE ((([Query1-2].BBit)=True));
The problem is that I want to add –or sum- the like columns (that have the same ID value) within that UNION statement…
ID A1 ABit
2 35 -1
3 41 -1
4 52 -1
4 62 -1
To make…
ID A1 ABit
2 35 -1
3 41 -1
4 114 -1
Am I going in the wrong direction here?