Cognos Analytics

Expand all | Collapse all

Multiple SELECT with conditions on one FROM

  • 1.  Multiple SELECT with conditions on one FROM

    Posted 23 days ago
    Hello everyone,

    I am trying to SELECT multiple data from a table (see below). Each SELECT would have its own condition (WHERE, IF, whatever ...). Each SELECT retreives a data either from ACK_FINDING, ACK_VALUE or ACK_NOTES

    Instead of calling the table via FROM for each SELECT in this way: SELECT val1 FROM mytable WHERE cond1 SELECT val2 FROM mytable WHERE cond2 ....

    To make an efficient code, I would like to write something like: SELECT val1 with cond1 val2 with cond2 FROM mytable

    Could you please help me to solve my problem?

    If any information is missing, please let me know!

    Thank you!



    ------------------------------
    Antoine André
    ------------------------------


  • 2.  RE: Multiple SELECT with conditions on one FROM

    Posted 21 days ago

    Hello Antoine,

    to rephrase your needs: You are looking for
    • a SELECT * FROM mytable WHERE val1= cond1 and val2=cond2 and ....,
    • or  SELECT cal1, val2, val3 .... FROM mytable WHERE val1= cond1 and val2=cond2 and ....
    So if I understand this right, then just pick the items from your table and define the conditions as filters.

    Regards



    ------------------------------
    Gertrud Lohwasser
    ------------------------------



  • 3.  RE: Multiple SELECT with conditions on one FROM

    Posted 20 days ago
    Hello Gertrud,

    Thank you for your reply.
    I think I did not explain my problem correctly. I want to retrieve values from the columns ACK_FINDING, ACK_VALUE or ACK_NOTES by applying conditions on the columns ACK_DESC and/or OBJ_DESC.

    For instance, I would like to retrieve:
    ACK_VALUE where ACK_DESC='conductivity data record' , ACK_FINDING where ACK_DESC='check safety valve' and OBJ_DESC='Biocide dosing pump' , etc ... while using FROM only once (I also use a query to create my table and I do not want to call the table each time I pick up a value since I need to retrieve a lot of data).

    Best regards.

    ------------------------------
    Antoine André
    ------------------------------