Hey guys and gals,
I figured out an output set query element for "Number of Unique Perfs For Keyword" using a multi-select parameter to choose TKW rows, but something is confusing me about what I had to do to get it to work:
Data select: count(distinct perf_no)
Data from: (SELECT a.customer_no, a.perf_no, b.tkw FROM dbo.VS_TICKET_HISTORY a JOIN dbo.V_INV_TKW_LIST b ON a.perf_no = b.perf_no) a
Data where: tkw IN (<<p7>>)
So what I'm curious about is the 'a' alias I had to add after my subquery. I haven't seen this in any other elements (or in a cursory review of the cookbook), but I get errors if I remove it. Also in my select, I don't have a !. before perf_no since it doesn't appear to be necessary in other elements when contained within a function. Curiously, if I add the !. to the select and remove the a alias for the from subquery, I am able to set the parameter value for an output set, but running the output set yields a weird error about "Column '#work1.customer_no' is invalid in the select list...".
So, just wondering what the appropriate way to do this is, or if I've inadvertently found it.
In case anyone wants to replicate, my query element parameter row for ID 7 is as follows:
Type: String
Multiselect: Y
Ref tbl: TR_TKW; Ref ID: id; Ref Desc: description
Ref where: used_in IN ('P', 'B')
Ref sort: category, description
Unknown said: ... So what I'm curious about is the 'a' alias I had to add after my subquery. ...
... So what I'm curious about is the 'a' alias I had to add after my subquery. ...
I recently learned that AP_FLEX_HEADER doesn't like column aliases in the sql_code column of TR_FLEX_HEADER_ELEMENT.
I wonder if your code would work if you moved it to a view, which you then used in TR_QUERY_ELEMENT.