|
-
Nov 7th, 2008, 08:54 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] All records based on aggregate function
My SQL is a bit rusty and I'm trying to clean up some data.
What i need is to do is UPDATE some of the records in a table where
the COUNT for [field1] = 2.
My initial select query gives me the set to look through, but now what?
I need to change some [tbl_item].itemvalue in this set, where itemvalue = 'baddata' make it 'gooddata'
select itemcode,count(itemcode) from tbl_item
group by itemcode
having count(itemcode)=2
in other words, there are some records where itemvalue='baddata' and we do not want to change them, unless that itemcode is in the table exactly twice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|