Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Strange SQL problem

  • 20-05-2009 10:19am
    #1
    Registered Users, Registered Users 2 Posts: 528 ✭✭✭


    Hi guys,

    I have an SQL query I am running. The query looks as follows;

    SELECT TIME_STAMP, MSISDN, SUM(SUCCESS_2G), SUM(SUCCESS_3G)
    FROM
    (
    SELECT D.TIME_STAMP, I.MSISDN, A.SUCCESS SUCCESS_2G, 0 SUCCESS_3G
    FROM TABLE_1 A, DAY_TIME_DIMENSION D, IMSI_MAPPING I
    --WHERE D.TIME_STAMP = TRUNC((SYSDATE-75),'DD')
    WHERE D.DATE_ID BETWEEN 3348 AND 3354
    AND A.IMSI_ID=I.IMSI_ID
    AND A.DATE_ID=D.DATE_ID
    AND I.MSISDN=12345678
    UNION
    SELECT D.TIME_STAMP, I.MSISDN, 0 SUCCESS_2G, B.SUCCESS SUCCESS_3G
    FROM DAY_TIME_DIMENSION D, TABLE_2 B, IMSI_MAPPING I
    --WHERE D.TIME_STAMP = TRUNC((SYSDATE-75),'DD')
    WHERE D.DATE_ID BETWEEN 3348 AND 3354
    AND B.IMSI_ID=I.IMSI_ID
    AND B.DATE_ID=D.DATE_ID
    AND I.MSISDN=12345678
    )
    GROUP BY MSISDN

    When I run the query in DBvisualiser it works fine but when I try and run it on a linux system it just hangs. I have tried altering the query but nothing seems to work. Any suggestions. Thanks in advance.


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Looks like it might be a pretty hefty query. What DMBS are you using?


  • Registered Users, Registered Users 2 Posts: 528 ✭✭✭ridonkulous


    Figured it out. Thanks anyway. Mods close thread if you wish.


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    I'm unsure how the query is working anywhere.

    TIME_STAMP is neither a grouped expression nor a group-by expression in the outer query. This should be illegal....unless somehow TIME_STAMP is a system-level reserved word, in which case it would seem very strange that is it also defined as a column-name in TIME_DIMENSION.

    Assuming I'm missing something there, I'd delete the commented out lines, just in case there's a problem with the interpreter somehow handling them strangely.


Advertisement