Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help me to remove duplicate data

Author  Topic 

basawareddy
Starting Member

11 Posts

Posted - 2009-04-14 : 03:15:17
Hi Friends,

I have written following query.

select f.TestDesc,f.Totobs,f.Green,f.Yellow,f.red,prmDtls.tpd_field2,prmDtls.tpd_field3,prmDtls.tpd_field7,prmDtls.tpd_field8
,prmDtls.tpd_field9,e.unitcode,e.Yellowcount,d.YellowRmarks,e.Redcount,d.RedRmarks--,e.TestCode,e.param
from (select * from [ConcatRemarks](@Units,@FromDate,@ToDate)) d
join
(select * from [ConcatUnits](@Units,@FromDate,@ToDate)) e on (e.TestCode = d.TestCode and e.param = d.param)
join
qc_test_parameter_detail prmDtls on ( e.param=prmDtls.tpd_code and e.testcode=prmDtls.tpd_test_code)
right join
(select th_description TestDesc,trd_test_code tstcode,th_sort_order,sum(trd_observations) TotObs,sum(trd_green) Green,sum(trd_yellow) Yellow,sum(trd_red) Red
from qc_transaction_detail,qc_transaction_header,qc_test_header
where trd_unit_code in (select * from fnSplit(@Units,','))
and trh_date >= @FromDate and trh_date <= @ToDate
and trh_code=trd_trn_header_code
and trd_test_code = th_code
group by th_description,trd_test_code,th_sort_order
)f on e.testcode=f.tstcode
order by f.th_sort_order

It will return result as same as

Water Treatment 217 217 0 0 NULL
Adjunct Cooking 204 148 0 56 TEMPERATURE
Adjunct Cooking 204 148 0 56 TOTAL GELATINISATION TIME
Milling and Mashing 416 387 0 29 TEMPERATURE

But i want in following manner.

Water Treatment 217 217 0 0 NULL
Adjunct Cooking 204 148 0 56 TEMPERATURE
TOTAL GELATINISATION TIME
Milling and Mashing 416 387 0 29 TEMPERATURE

Plz help me to solve.

Thanks
Basawareddy M Gopsen.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-14 : 03:17:00
Duplicate post http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=123759



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

basawareddy
Starting Member

11 Posts

Posted - 2009-04-14 : 03:21:04
Hi Friends,

Yes it is duplicate post but here i have mentioned correctly.

appreciate your help.

Thanks,
Basawareddy
Go to Top of Page
   

- Advertisement -