Link to home
Create AccountLog in
Avatar of rwallacej
rwallacej

asked on

Convert a SELECT statement to DELETE

Hi

I've got a select statement that needs converted to a delete. See SQL here:

The SQL select records where count = 1

Whats the DELETE? Thanks
SELECT datacaptureid, count(*) TotalCount
FROM tblCompressor
GROUP BY DataCaptureID
HAVING Count(*) = 1
ORDER BY Count(*)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ee_rlee
ee_rlee
Flag of Philippines image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of rwallacej
rwallacej

ASKER

thanks for help,
I tried ee_rlee query and it worked
angelIII - this field is Indexed, DataCaptureID is primary key, but no other field uniquely identifies row; I'll keep this in mind for future thanks
>angelIII - this field is Indexed, DataCaptureID is primary key
interesting... because if the field IS primary key, that query will actually delete all the rows, won't it?
angelIII
sorry I have err'd, this isn't a primary key
thanks