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 2005 Forums
 Analysis Server and Reporting Services (2005)
 oracle database

Author  Topic 

ich28
Starting Member

5 Posts

Posted - 2008-06-10 : 00:05:51
the following query cannot be executed using oracle database


quote:

select

participant.participant_id,

sum(case participant.participant_id when log.donor_id then 1 else 0 end) as [port_in],

sum(case participant.participant_id when log.receipient_id then 1 else 0 end) as [port_out]

from log log, (

select distinct donor.donor_id as [participant_id]

from log donor

union

select distinct receipient.receipient_id as [participant_id]

from log receipient

) participant

group by participant.participant_id


can anyone please help me?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-10 : 00:26:50
Why do you want to use two datasets? Do you mean you need to show completely unrelated data in same matrix? Can you specify what your requirement is?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-10 : 04:59:15
Huh? Reformatting your code makes it look like this. No obvious errors here...
select		participant.participant_id,
sum(case participant.participant_id when log.donor_id then 1 else 0 end) as [port_in],
sum(case participant.participant_id when log.receipient_id then 1 else 0 end) as [port_out]
from log log
CROSS JOIN (
select distinct donor.donor_id as [participant_id]
from log donor

union

select distinct receipient.receipient_id as [participant_id]
from log receipient
) participant
group by participant.participant_id
What is the error you get?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-10 : 05:03:43
[code]SELECT p.ParticipantID,
SUM(CASE WHEN p.ParticipantID = l.Donor_ID THEN 1 ELSE 0 END) AS Port_In,
SUM(CASE WHEN p.ParticipantID = l.Receipient_ID THEN 1 ELSE 0 END) AS Port_Out
FROM [Log] AS l
CROSS JOIN (
SELECT Donor_ID AS ParticipantID
FROM [Log]

UNION

SELECT Receipient_ID
FROM [Log]
) AS p
GROUP BY p.ParticipantID[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ich28
Starting Member

5 Posts

Posted - 2008-06-10 : 06:05:27
i have tried the statement u suggested but it also cannot be executed...
thanks for ur replied by the way...
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-10 : 06:10:36
What is the error you get?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ich28
Starting Member

5 Posts

Posted - 2008-06-12 : 23:56:16
i have found the solution finally...

quote:
select participant."ParticipantID"
sum(case participant."ParticipantID" when xnp_port_data.recipient_id then 1 else 0 end) as "Port IN",
sum(case participant."ParticipantID" when xnp_port_data.donor_id then 1 else 0 end) as "Port OUT"
from ( SELECT distinct Donor_ID AS "ParticipantID" FROM xnp_port_data UNION
SELECT distinct Recipient_ID AS "ParticipantID" FROM xnp_port_data
) participant, xnp_port_data

group by participant."ParticipantID"




thanks for your replied.
Go to Top of Page
   

- Advertisement -