Solved query repeating rows (1 Viewer)

mhakim

Member
Local time
Today, 05:19
Joined
Jan 25, 2021
Messages
72
hi dears
good day

please look at two PIC Attached

i have Trialbalance Query show Total Account Transaction for all Pettycash Employees it is very good query i like it

so the proplem here when i want the total account query to be in details by Employees like second PIC , It will reapeat many wrong transactions except only two yellow Transactions in yellow color are correct . i have only two Employee number 3001 and 3002

if any one meet this situation before please advice
 

Attachments

  • Trial Balance Total Account.PNG
    Trial Balance Total Account.PNG
    21.5 KB · Views: 182
  • Trial Balance Details.PNG
    Trial Balance Details.PNG
    72.8 KB · Views: 191

oleronesoftwares

Passionate Learner
Local time
Yesterday, 19:19
Joined
Sep 22, 2014
Messages
1,159
so the proplem here when i want the total account query to be in details by Employees like second PIC , It will reapeat many wrong transactions except only two yellow Transactions in yellow color are correct . i have only two Employee number 3001 and 3002
Did you add GroupBy employee name in the query?

Also is there a way unique records are identified in your table and is this field in your query?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:19
Joined
May 7, 2009
Messages
19,243
if you can see it has Different "thirdparty_id", how did you get the "thirdparty_id" (maybe there is no join).
 

oleronesoftwares

Passionate Learner
Local time
Yesterday, 19:19
Joined
Sep 22, 2014
Messages
1,159
Looking more closely at your images, are you sure you are not using an insert query instead of a select query

A select statement can't repeat wrong records, i.e "It will repeat many wrong transactions except only two yellow Transactions in yellow color are correct"

The only two records in yellow that are the correct records, are the records manually posted, while the wrong transactions i suspect are records posted via insert query.
 

mhakim

Member
Local time
Today, 05:19
Joined
Jan 25, 2021
Messages
72
Looking more closely at your images, are you sure you are not using an insert query instead of a select query

A select statement can't repeat wrong records, i.e "It will repeat many wrong transactions except only two yellow Transactions in yellow color are correct"

The only two records in yellow that are the correct records, are the records manually posted, while the wrong transactions i suspect are records posted via insert query.
what is the insert query ?
 

oleronesoftwares

Passionate Learner
Local time
Yesterday, 19:19
Joined
Sep 22, 2014
Messages
1,159
An insert query copies record(s) using some parameters from one table to the other, or within the same table.

It is one of the four major types of queries.

The other types of queries are

A. Select(Used to retrieve records)
B Update(Used to change the value of field(s) in a table)
C. Delete(Used to delete records from a table)
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:19
Joined
Feb 19, 2002
Messages
43,275
You need to turn this into a totals query which groups by the first three columns and sums the others. That will eliminate the duplicates.
 

Users who are viewing this thread

Top Bottom