Solarion
Honorary Master
- Joined
- Nov 14, 2012
- Messages
- 28,051
- Reaction score
- 17,804
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Group by PersalNo?
Your query will never work the way you are trying too with that data.
You are counting and grouping on a column that have different values.
If you look at your LeaveRefNum... for the same persalno you have two different values in LeaveRefNum. LA/07 and LA/06. as nfbs.
If you leave out LeaveRefNum your counts should work the way you are trying... as q1.
Whenever you are joining to multiple tables and aggregating something and you get these types of results you can bet that there is a column with different values on one of the groupings.