Solved

One entry per record

Posted on 2014-03-04
4
268 Views
Last Modified: 2014-03-06
I need a query that will only find only one (1) entry in the record where the Descvalue field is "Hot Tap Clamps - Exempt".
One-Entry.bmp
0
Comment
Question by:donnie91910
4 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 150 total points
ID: 39905112
try this


SELECT tbl_x.facilityID, Count(tbl_x.facilityID) AS CountOffacilityID, tbl_x.Descvalue
FROM tbl_x
GROUP BY tbl_x.facilityID, tbl_x.Descvalue
Having (((Count(tbl_x.facilityID))=1) AND ((tbl_x.Descvalue)="Hot Tap Clamps - Exempt"))
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 200 total points
ID: 39905174
How about this:
SELECT A.FacilityID 
FROM TableName As A INNER JOIN (SELECT FacilityID, Count(FacilityID) AS CountID
FROM TableName
GROUP BY FacilityID) As B ON A.FacilityID = B.FacilityID
WHERE A.Descvalue="Hot Tap Clamps - Exempt" And B.CountID=1

Open in new window

Ron
0
 
LVL 7

Assisted Solution

by:COACHMAN99
COACHMAN99 earned 150 total points
ID: 39905256
why not use TOP?
e.g.
SELECT TOP 1 Tx.TX_Description, Tx.Cust_ID FROM Tx WHERE (((Tx.Cust_ID)=78));
0
 

Author Closing Comment

by:donnie91910
ID: 39911410
Thank you.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now