Cognos Analytics

 View Only
  • 1.  Multiple SELECT with conditions on one FROM

    Posted Fri April 16, 2021 09:48 AM
    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é
    ------------------------------

    #CognosAnalyticswithWatson


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

    Posted Mon April 19, 2021 04:02 AM

    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



    #CognosAnalyticswithWatson


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

    Posted Mon April 19, 2021 09:20 PM
    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é
    ------------------------------