Re: identify semi-duplicate records, and amend elements of those r
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Thu, 13 Apr 2006 15:20:11 -0400
AUUUGH!!!! Names with spaces AUUGGHH!!!!
Ok, that's out of my system.
Anytime you have spaces in a field name or table name you HAVE to surround
the name with [] or you will get an error. You are missing the [] in the
following
Sum(HH CCY CFAMT) = 0
which should be
Sum([HH CCY CFAMT]) = 0
In (SELECT [PORTFOLIO NAME] FROM [Edit Transactions] As Tmp
GROUP BY [PORTFOLIO NAME],[BACKOFFICE PROCESS DATE],[BACKOFFICE ENTRY
CODE],[INSTRUMENT DESCRIPTION]
HAVING Count(*)>1 And
Sum([HH CCY CFAMT]) = 0 And
[BACKOFFICE PROCESS DATE] = [Edit Transactions].[BACKOFFICE PROCESS DATE]
And
[BACKOFFICE ENTRY CODE] = [Edit Transactions].[BACKOFFICE ENTRY CODE] And
[INSTRUMENT DESCRIPTION] = [Edit Transactions].[INSTRUMENT DESCRIPTION])
Hope this works.
"Tom MacKay" <TomMacKay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:400424F3-E83B-4D40-9D32-3723AD289BD7@xxxxxxxxxxxxxxxx
I have inserted this statement into the Criteria for a Query, under the AAA
column.but the response is "Syntax Error in query expresion "((([Edit
Transactions].[AAA] IN...".
Maybe the problem is where I have used it?
Here is exactly what I used...and sorry, but the simplified field names
are
now gone.... :-)
In (SELECT [PORTFOLIO NAME] FROM [Edit Transactions] As Tmp
GROUP BY [PORTFOLIO NAME],[BACKOFFICE PROCESS DATE],[BACKOFFICE ENTRY
CODE],[INSTRUMENT DESCRIPTION]
HAVING Count(*)>1 And
Sum(HH CCY CFAMT) = 0 And
[BACKOFFICE PROCESS DATE] = [Edit Transactions].[BACKOFFICE PROCESS DATE]
And
[BACKOFFICE ENTRY CODE] = [Edit Transactions].[BACKOFFICE ENTRY CODE] And
[INSTRUMENT DESCRIPTION] = [Edit Transactions].[INSTRUMENT DESCRIPTION])
"John Spencer" wrote:
I think what you want is the following. This should only return a
possible
match if the Sum of EEE is zero for the group. Then the match will be
determined on the first four fields
In (SELECT [AAA] FROM [Edit Transactions] As Tmp
GROUP BY [AAA],[BBB],[CCC],[DDD]
HAVING Count(*)>1 And
Sum(EEE) = 0 And
[BBB] = [Edit Transactions].[BBB] And
[CCC] = [Edit Transactions].[CCC] And
[DDD] = [Edit Transactions].[DDD])
"Tom MacKay" <TomMacKay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3C5A3FC5-6F99-402C-8D19-77CB55B6D095@xxxxxxxxxxxxxxxx
I am trying to (i) take an existing table, scan it, and identify records
where 4 particular fields match and the sum of another field is zero.
and
then (ii) update a different field on both/any records that qualify
I am trying to learn how to build part (i) by using a Find Duplicates
query,
hoping I could then take the expression, amend it and insert it into
the
field to be used in an IIF statement within an Update Table query...but
that's getting ahead of myself.
The table id Edit Transactions.
The four fields to match are AAA, BBB, CCC and DDD
The field whose sum should be 0 is EEE
Anyways, this is what the Find Duplicates query produced:
In (SELECT [AAA] FROM [Edit Transactions] As Tmp GROUP BY
[AAA],[BaBB],[CCC],[DDD],[EEE] HAVING Count(*)>1 And [BBB] = [Edit
Transactions].[BBB] And [CCC] = [Edit Transactions].[CCC] And [DDD] =
[Edit
Transactions].[DDD] And [EEE] = [Edit Transactions].[EEE])
Doesn't work obviously...it matches on all 5 fields instead, not bad,
but
I
cannot amend the last statement to
[EEE] = -1*[Edit Transactions].[EEE]
or
[EEE] + [Edit Transactions].[EEE] = 0
or anything to make it work...and reading the other posts on Duplicates
querying is difficult so far...
Any ideas, please let me know.
Txs,
Tom
.
- Follow-Ups:
- Re: identify semi-duplicate records, and amend elements of those r
- From: Tom MacKay
- Re: identify semi-duplicate records, and amend elements of those r
- References:
- Re: identify semi-duplicate records, and amend elements of those recor
- From: John Spencer
- Re: identify semi-duplicate records, and amend elements of those r
- From: Tom MacKay
- Re: identify semi-duplicate records, and amend elements of those recor
- Prev by Date: Re: Zip Code Radius lookup using Access and ASP
- Next by Date: Re: Query Help: Selecting records for each instance of value in a table?
- Previous by thread: Re: identify semi-duplicate records, and amend elements of those r
- Next by thread: Re: identify semi-duplicate records, and amend elements of those r
- Index(es):
Relevant Pages
|