0

Hi. I'm having a problem on deleting a record using a function on SQL.
DELETE FROM tblServices GROUP BY ServiceID HAVING MID(ServiceID,1,2)='SG'

This query shows and error saying: Cannot group on fields selected with '*'.
I tried adding a specific field, like this:
DELETE ServiceID FROM tblServices GROUP BY ServiceID HAVING MID(ServiceID,1,2)='SG'
but it shows the same result.

Please help me.
Michael

3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by crishlay
0

try the following , may work for you.

DELETE ServiceID FROM tblServices 
where serviceid in (select ServiceID FROM tblServices GROUP BY ServiceID HAVING MID(ServiceID,1,2)='SG')

Edited by debasisdas: n/a

0

debasisdas,

That helps! I didn't know about that "IN", I should explore more on SQL. Thanks a lot!

Cheers,
Michael

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.