You are here: Re: Need Emergency Help with SQL Query (difficulty: moderate) « MsSQL Server « IT news, forums, messages
Re: Need Emergency Help with SQL Query (difficulty: moderate)

Posted by othellomy on 11/30/06 08:06

Here is one solution:

Delete Appointment a
Where exists (select 'hi there'
From Entity e
Where a.attendee = e. attendee
Group by e. attendee
Having count(e. attendee) <= 1)

You can do the similar step with the intersect table
Appointment_Entity.

Brian Link wrote:
> Panicked, as usual. Who says it's great being a sole proprietor?
>
> Using MS-SQLServer:
>
> Three tables: A_Appointment, AX_Appointment_Entity and E_Entity.
> AX_Appointment_Entity is an intersect/association table between
> A_Appointment and E_Entity. One appointment may have many attendees
> (Appointment_Entity). One attendee (Entity) may have many
> appointments.
>
> My task is to delete all appointments and related
> AX_Appointment_Entity rows where the number of attendees is one or
> less.
>
> I'm great at standard select or delete queries. Because this straddles
> tables in a way I'm less skilled in, I'm pleading for help.
>
> Thanks for any ideas. fwiw, I'm using Transact-SQL.
>
> BLink
> --------------------------
> "The worst thing about censorship is [redacted]"

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация