On Fri, Jan 23, 2009 at 11:29 AM, Matt Jarvis <[email protected]> wrote:
> I'm trying to run a query in order to delete some records as instructed
> by tech support for an app we use. This is actually on a SQL Server 2000
> back end.
>
>
>
> This query pulls 1321 records, but for some reason I can't get the
> syntax right for a Delete. Is it even possible due to the aggregate
> Group By?
>
>
>
> Select fpono, fpartno, fitemno
> >From POITEM
> Group by fpono, fpartno, fitemno
> Having count(*)>1
>
-----------------------

Delete POItem
where  [your key column] in
 (
select Thatkey col from (
Select fpono, fpartno, fitemno
> >From POITEM
> Group by fpono, fpartno, fitemno
> Having count(*)>1)
)

So your having count runs first, and your then pull out of it the key
to use against the table you want.

clear as mud?

-- 
Stephen Russell
Sr. Production Systems Programmer
First Horizon Bank
Memphis TN

901.246-0159

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to