Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Union order
Message
De
29/08/2008 15:36:57
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01343299
Message ID:
01343325
Vues:
23
It's a tag for weather or not it was "Dist"ributed hours, so I put 0 and 1 (False and True). Made sense to me :)

>Strange name for the order field...
>
>>I think I got it. Much thanks to you
>>
DECLARE @cJobNo as VARCHAR(10)
>>
>>SET @cJobNo = '11709'
>>
>>SELECT TimeHD.Empid, TimeHD.EmpName,
>>	sum(regtime) as RegTime,sum(overtime) as OverTime, Sum(doubletime) as DoubleTime,
>>	sum(regtime+overtime+doubletime) as TotalHours1,
>>	'0' as Dist
>>FROM TimeHd INNER JOIN
>>	TimeItms ON TimeHd.timecrdno = TimeItms.timecrdno
>>Where TimeItms.JobNo = @cJobNo and
>>	TimeItms.[distributed] <> 1
>>
>>group by TimeHD.Empid, TimeHD.EmpName
>>
>>UNION ALL
>>
>>SELECT TimeHD.Empid, TimeHD.EmpName,
>>	sum(regtime) as RegTime,sum(overtime) as OverTime, Sum(doubletime) as DoubleTime,
>>	sum(regtime+overtime+doubletime) as TotalHours1,
>>	'1' as Dist
>>FROM TimeHd INNER JOIN
>>	TimeItms ON TimeHd.timecrdno = TimeItms.timecrdno
>>Where TimeItms.JobNo = @cJobNo and
>>	TimeItms.[distributed] = 1
>>
>>group by TimeHD.Empid, TimeHD.EmpName
>>
>>order by empid, Dist
>>
>>>You cannot expect records to be in any particular order w/o ORDER BY clause. Add one more column, put 1 for the first select and 2 for second select and ORDER BY on it.
>>>
>>snip...
Thanks
Jon
Non-MVP Non-MCP Non-MCSE

Visual FoxPro, What else is there?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform