Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with query
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01123386
Message ID:
01123391
Vues:
22
Can you post some simple data and desired result? Why you use TOP 100 PERCENT?

>The following queries brings back the information I need, but not in the way I can use it. I'm trying to get a record set of all cases scheduled that have an assistant assigned as the Initial (AssistID) or Secondary (Assist2ID). Some cases will have one or the other and some with all both. I'm trying to create a record set that I can run a report on that will be ordred by Assisting (won't matter if they are initial or secondary).
>
>Thanks in Advance
>
>
>SELECT top 100 percent
>	meetings.BeginTime as ScheduledStart,
>	coDept.deptDesc,
>	isnull((select ltrim(rtrim(dbo.coPer.LastName))+', '+rtrim(dbo.coPer.FirstName)
>		from dbo.coPer where coPer.coPerID=meetings.AssistID),' ') as Assisting1,
>	isnull((select ltrim(rtrim(dbo.coPer.LastName))+', '+rtrim(dbo.coPer.FirstName)
>		from dbo.coPer where coPer.coPerID=meetings.Assist2ID),' ') as Assisting2,
>	isnull(dbo.Get_PrimaryProcDescByMeetID(meetings.meetingnumber),'No Proc. Asgn') as PrimaryProcedureDesc
>FROM   dbo.patients INNER JOIN
>       dbo.meetings ON dbo.patients.patientid = dbo.meetings.patientid inner join
>       dbo.codept ON dbo.meetings.deptid = dbo.codept.deptid INNER JOIN
>       dbo.corooms ON dbo.meetings.roomid = dbo.corooms.roomid
>where  meetings.begintime between @ltQueryFrom and @ltQueryTo
>and   meetings.iscancelled=0
>and   meetings.isblock=0
>and   meetings.RoomClosed=0
>and (meetings.assistID>0 or meetings.assist2ID>0)
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform