Solved

One entry per record

Posted on 2014-03-04
4
272 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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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