Hi All,
I am new at SQL but I am doing my best to query two tables.
The below Query works but returns the same values 3 times for each.
Query:
SELECT
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME,
ERICSSON_UTRAN.RNC_UCELL_DY.RNC,
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL,
(PMTOTNORRCCONNECTREQCS) AS CS_RRC_ATTS,
(PMTOTNORRCCONNECTREQCSSUCC / (PMTOTNORRCCONNECTREQCS - PMNOLOADSHARINGRRCCONNCS)) * 100 AS CS_RRC_PERCENT,
(PMNORABESTABLISHATTEMPTSPEECH) AS CS_RAB_ATTS,
(PMNORABESTABLISHSUCCESSSPEECH / PMNORABESTABLISHATTEMPTSPEECH) * 100 AS CS_RAB_PERCENT,
(PMNOSYSTEMRABRELEASESPEECH) AS CS_DROPS,
(PMNOSYSTEMRABRELEASESPEECH / PMNORABESTABLISHSUCCESSSPEECH) * 100 AS CS_DROPS_RATE,
((PMNOSYSRELSPEECHSOHO - PMNOSYSRELSPEECHNEIGHBR) / PMNOSYSTEMRABRELEASESPEECH) * 100 AS SOHO_PERCENT,
(PMNOSYSRELSPEECHNEIGHBR / PMNOSYSTEMRABRELEASESPEECH) * 100 AS MISSING_NEIGH,
(PMNOSYSRELSPEECHULSYNCH / PMNOSYSTEMRABRELEASESPEECH) * 100 AS UL_SYNC,
(PMRLADDATTEMPTSBESTCELLSPEECH) AS CS_SHO_ATTS,
(PMRLADDSUCCESSBESTCELLSPEECH / PMRLADDATTEMPTSBESTCELLSPEECH) * 100 AS CS_SHO_SUCC_PERCENT,
((PMNOSUCCESSOUTIRATHOSPEECH + PMNOSUCCESSOUTIRATHOMULTI) / (PMNORABESTABLISHSUCCESSSPEECH)) * 100 AS IRAT_PERCENT,
((PMNOSYSTEMRABRELEASESPEECH - PMNOOFTERMSPEECHCONG - PMNOSYSRELSPEECHSOHO - PMNOSYSRELSPEECHULSYNCH - (PMNOATTOUTIRATHOSPEECH - PMNOFAILOUTIRATHOSPCHUEREJECT - PMNOSUCCESSOUTIRATHOSPEECH - PMNFOIRATHOSPCHCHNOTPHYCHFAIL - PMNFLOUTIRATHOSPCHCHPHYCHFAIL)) / PMNOSYSTEMRABRELEASESPEECH) * 100 AS OTHER_PERCENT,
((NVL(PMNOATTOUTIRATHOMULTI, 0) + NVL(PMNOATTOUTIRATHOSPEECH, 0) + NVL(PMNOATTOUTIRATHOSTANDALONE, 0) + NVL(PMNOATTOUTSBHOSPEECH, 0) + NVL(PMNOFAILOUTIRATHOMULTIGSMFAILR, 0) + NVL(PMNOSUCCESSOUTIRATHOSPEECH, 0) + NVL(PMNOFAILOUTIRATHOSPCHGSMFAIL, 0) + NVL(PMNOFAILOUTSBHOSPEECHGSMFAILRE, 0))) AS IRAT_HO_ATTS,
((PMNOSUCCESSOUTIRATHOSPEECH + PMNOSUCCESSOUTIRATHOMULTI) / PMNORABESTABLISHSUCCESSSPEECH) AS LOST_TO_GSM,
((PMSUMBESTCS12ESTABLISH / PMSAMPLEBSTCS12PSINTRABESTBLSH) + (PMSUMBESTAMR5900RABESTABLISH / PMSAMPLESAMR5900RABESTABLISH) + (PMSUMBESTAMR4750RABESTABLISH / PMSAMPLESAMR4750RABESTABLISH) + (PMSUMBESTAMR7950RABESTABLISH / PMSAMPLESAMR7950RABESTABLISH) + (PMSUMBESTAMR12200RABESTABLISH / PMSAMPLESAMR12200RABESTABLISH)) AS CS_ERLANGS
FROM
ERICSSON_UTRAN.RNC_UCELL_DY,
ERICSSON_UTRAN.RNC_GSMRELATION_DY
WHERE
substr(ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL, 1, 7) IN ('TXU0001') AND
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME BETWEEN TO_DATE('27-DEC-2011 00:00:00', 'DD-MON-YYYY HH24:MI:SS') AND
TO_DATE('27-DEC-2011 23:59:59', 'DD-MON-YYYY HH24:MI:SS') and
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME= ERICSSON_UTRAN.RNC_GSMRELATION_DY.DATETIME and
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL=ERICSSON_UTRAN.RNC_GSMRELATION_DY.UTRANCELL
ORDER by
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME,
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL
The Query Returns this:
DATETIME RNC UTRANCELL CS_RRC_ATTS CS_RRC_PERCENT CS_RAB_ATTS CS_RAB_PERCENT CS_DROPS CS_DROPS_RATE
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
As you can see it repeats the TXU00011 3 times.
How do I get this query to return only one TXU00011.
Any helps is greatly appreciated...I went and bought two sql books but cant seem to get it figured out.
Also if there is a better way to code this I am al ears as well.
Cheers,
Ray
I am new at SQL but I am doing my best to query two tables.
The below Query works but returns the same values 3 times for each.
Query:
SELECT
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME,
ERICSSON_UTRAN.RNC_UCELL_DY.RNC,
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL,
(PMTOTNORRCCONNECTREQCS) AS CS_RRC_ATTS,
(PMTOTNORRCCONNECTREQCSSUCC / (PMTOTNORRCCONNECTREQCS - PMNOLOADSHARINGRRCCONNCS)) * 100 AS CS_RRC_PERCENT,
(PMNORABESTABLISHATTEMPTSPEECH) AS CS_RAB_ATTS,
(PMNORABESTABLISHSUCCESSSPEECH / PMNORABESTABLISHATTEMPTSPEECH) * 100 AS CS_RAB_PERCENT,
(PMNOSYSTEMRABRELEASESPEECH) AS CS_DROPS,
(PMNOSYSTEMRABRELEASESPEECH / PMNORABESTABLISHSUCCESSSPEECH) * 100 AS CS_DROPS_RATE,
((PMNOSYSRELSPEECHSOHO - PMNOSYSRELSPEECHNEIGHBR) / PMNOSYSTEMRABRELEASESPEECH) * 100 AS SOHO_PERCENT,
(PMNOSYSRELSPEECHNEIGHBR / PMNOSYSTEMRABRELEASESPEECH) * 100 AS MISSING_NEIGH,
(PMNOSYSRELSPEECHULSYNCH / PMNOSYSTEMRABRELEASESPEECH) * 100 AS UL_SYNC,
(PMRLADDATTEMPTSBESTCELLSPEECH) AS CS_SHO_ATTS,
(PMRLADDSUCCESSBESTCELLSPEECH / PMRLADDATTEMPTSBESTCELLSPEECH) * 100 AS CS_SHO_SUCC_PERCENT,
((PMNOSUCCESSOUTIRATHOSPEECH + PMNOSUCCESSOUTIRATHOMULTI) / (PMNORABESTABLISHSUCCESSSPEECH)) * 100 AS IRAT_PERCENT,
((PMNOSYSTEMRABRELEASESPEECH - PMNOOFTERMSPEECHCONG - PMNOSYSRELSPEECHSOHO - PMNOSYSRELSPEECHULSYNCH - (PMNOATTOUTIRATHOSPEECH - PMNOFAILOUTIRATHOSPCHUEREJECT - PMNOSUCCESSOUTIRATHOSPEECH - PMNFOIRATHOSPCHCHNOTPHYCHFAIL - PMNFLOUTIRATHOSPCHCHPHYCHFAIL)) / PMNOSYSTEMRABRELEASESPEECH) * 100 AS OTHER_PERCENT,
((NVL(PMNOATTOUTIRATHOMULTI, 0) + NVL(PMNOATTOUTIRATHOSPEECH, 0) + NVL(PMNOATTOUTIRATHOSTANDALONE, 0) + NVL(PMNOATTOUTSBHOSPEECH, 0) + NVL(PMNOFAILOUTIRATHOMULTIGSMFAILR, 0) + NVL(PMNOSUCCESSOUTIRATHOSPEECH, 0) + NVL(PMNOFAILOUTIRATHOSPCHGSMFAIL, 0) + NVL(PMNOFAILOUTSBHOSPEECHGSMFAILRE, 0))) AS IRAT_HO_ATTS,
((PMNOSUCCESSOUTIRATHOSPEECH + PMNOSUCCESSOUTIRATHOMULTI) / PMNORABESTABLISHSUCCESSSPEECH) AS LOST_TO_GSM,
((PMSUMBESTCS12ESTABLISH / PMSAMPLEBSTCS12PSINTRABESTBLSH) + (PMSUMBESTAMR5900RABESTABLISH / PMSAMPLESAMR5900RABESTABLISH) + (PMSUMBESTAMR4750RABESTABLISH / PMSAMPLESAMR4750RABESTABLISH) + (PMSUMBESTAMR7950RABESTABLISH / PMSAMPLESAMR7950RABESTABLISH) + (PMSUMBESTAMR12200RABESTABLISH / PMSAMPLESAMR12200RABESTABLISH)) AS CS_ERLANGS
FROM
ERICSSON_UTRAN.RNC_UCELL_DY,
ERICSSON_UTRAN.RNC_GSMRELATION_DY
WHERE
substr(ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL, 1, 7) IN ('TXU0001') AND
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME BETWEEN TO_DATE('27-DEC-2011 00:00:00', 'DD-MON-YYYY HH24:MI:SS') AND
TO_DATE('27-DEC-2011 23:59:59', 'DD-MON-YYYY HH24:MI:SS') and
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME= ERICSSON_UTRAN.RNC_GSMRELATION_DY.DATETIME and
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL=ERICSSON_UTRAN.RNC_GSMRELATION_DY.UTRANCELL
ORDER by
ERICSSON_UTRAN.RNC_UCELL_DY.DATETIME,
ERICSSON_UTRAN.RNC_UCELL_DY.UTRANCELL
The Query Returns this:
DATETIME RNC UTRANCELL CS_RRC_ATTS CS_RRC_PERCENT CS_RAB_ATTS CS_RAB_PERCENT CS_DROPS CS_DROPS_RATE
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
12/27/2011 AUSUTXNICRBR11 TXU00011 1052 99.42965779 1343 99.85107967 10 0.745712155
As you can see it repeats the TXU00011 3 times.
How do I get this query to return only one TXU00011.
Any helps is greatly appreciated...I went and bought two sql books but cant seem to get it figured out.
Also if there is a better way to code this I am al ears as well.
Cheers,
Ray