Query Help

B

Bonnie

Hi,

I have a table with two field:

LOGNumber and VINumber

I would like to see all the records where the VINumber is duplicated for a
particular LOGNumber. Can anyone help me please.

Thanks in advance.
 
D

Douglas J. Steele

Try something like:

SELECT LOGNumber, VINumber, Count(*)
FROM YourTableName
GROUP BY LOGNumber, VINumber
HAVING Count(*) > 1

To build this query through the graphical query builder, create a new query
and add your table to it. Drag to two fields into the grid, then type the
LOGNumber field into the grid a second time.

Change the query into a Totals query (there's an icon with a Sigma on it on
the button bar, or you can choose Totals from the View menu). That will add
new row (labelled Total:) to the grid, with the cell under each used column
set to Group By. Change the Group By to Count under the second occurrence of
LOGNumber, and put >1 as the criteria under that field.
 
W

Wayne-I-M

Hi

SELECT TableName.VINumber
FROM TableName
WHERE (((TableName.VINumber)=[TableName]![LOGNumber]));

Or - in design view - insert
[TableName]![LOGNumber]
In the criteria row of the VINumber column


Good luck
 
W

Wayne-I-M

I have just re-read your post. Do you want the result where the LOGnumber
and the VINumber are the same (see my last answer)

or

Do you want just the VINumbers that are equall to a "specific" LOGnumber.


--
Wayne
Manchester, England.



Wayne-I-M said:
Hi

SELECT TableName.VINumber
FROM TableName
WHERE (((TableName.VINumber)=[TableName]![LOGNumber]));

Or - in design view - insert
[TableName]![LOGNumber]
In the criteria row of the VINumber column


Good luck

--
Wayne
Manchester, England.



Bonnie said:
Hi,

I have a table with two field:

LOGNumber and VINumber

I would like to see all the records where the VINumber is duplicated for a
particular LOGNumber. Can anyone help me please.

Thanks in advance.
 
Top