List builder query join issue

In list builder, if I select more that one item that originates from the same table with the same column information, list builder creates an "AND" in where clause which is fine. However, this returns 0 records. So my question is, where can I modify how the aliases are assigned when the SQL code is created? I see RP_BUILD_QUERY but that seems to be just for Extractions.

Here is what I get from list builder:

Select Distinct a.customer_no
 From t_customer a (NOLOCK)
JOIN lv_const_cust_current e (NOLOCK) ON a.customer_no = e.customer_no
JOIN TX_CUST_KEYWORD f (NOLOCK) ON a.customer_no = f.customer_no
 Where  IsNull(a.inactive, 1) = 1
 AND e.constituency in  (35)
 AND f.key_value in  ('A')  AND f.keyword_no = 403
 AND f.key_value in  ('Individual')  AND f.keyword_no = 402

 

Here is what I need:

Select Distinct a.customer_no
 From t_customer a (NOLOCK)
JOIN lv_const_cust_current e (NOLOCK) ON a.customer_no = e.customer_no
JOIN TX_CUST_KEYWORD f (NOLOCK) ON a.customer_no = f.customer_no
JOIN TX_CUST_KEYWORD g (NOLOCK) ON a.customer_no = g.customer_no
 Where  IsNull(a.inactive, 1) = 1
 AND e.constituency in  (35)
 AND f.key_value in  ('A')  AND f.keyword_no = 403
 AND g.key_value in  ('Individual')  AND g.keyword_no = 402

 

Thanks in advance.

 

  • Hi Matt,

     

    You can’t change how criteria sets convert the graphical interface into SQL code, but you can edit the SQL code after it’s created.  Just click the Manual Edit button at the bottom right of the criteria set.  Then you can paste in the code you want.

     

    I suspect the cause of the result you are getting is that you have the IN operator selected instead of the HAS operator.  If that’s the case, change to HAS for both attribute criteria and I believe your query will work as automatically generated.

     

    For more details on manual edit mode and IN and HAS see the Criteria Sets document.

     

    Kevin Sheehan

    Documentation & Learning Resources Specialist

    Tessitura Network

    +1 888 643 5778 x 329

    ksheehan@tessituranetwork.com

     

  • Thank you for the quick response. Yes, I am aware I can change it manually but you know how users would receive that news:) I believe I am using "IN" so I will change that. Thanks again, this was helpful.

  • Hi Matt, I usually do this inside the list builder directly by clicking on the Display Query and then Manual Edit button. Not sure if you are asking for this though?

     

    Mo

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Matt Winchester
    Sent: Wednesday, December 15, 2010 12:57 PM
    To: Mohiuddin Faruqe
    Subject: [Tessitura Technical Forum] List builder query join issue

     

    In list builder, if I select more that one item that originates from the same table with the same column information, list builder creates an "AND" in where clause which is fine. However, this returns 0 records. So my question is, where can I modify how the aliases are assigned when the SQL code is created? I see RP_BUILD_QUERY but that seems to be just for Extractions.

    Here is what I get from list builder:

    Select Distinct a.customer_no
     From t_customer a (NOLOCK)
    JOIN lv_const_cust_current e (NOLOCK) ON a.customer_no = e.customer_no
    JOIN TX_CUST_KEYWORD f (NOLOCK) ON a.customer_no = f.customer_no
     Where  IsNull(a.inactive, 1) = 1
     AND e.constituency in  (35)
     AND f.key_value in  ('A')  AND f.keyword_no = 403
     AND f.key_value in  ('Individual')  AND f.keyword_no = 402

     

    Here is what I need:

    Select Distinct a.customer_no
     From t_customer a (NOLOCK)
    JOIN lv_const_cust_current e (NOLOCK) ON a.customer_no = e.customer_no
    JOIN TX_CUST_KEYWORD f (NOLOCK) ON a.customer_no = f.customer_no
    JOIN TX_CUST_KEYWORD g (NOLOCK) ON a.customer_no = g.customer_no
     Where  IsNull(a.inactive, 1) = 1
     AND e.constituency in  (35)
     AND f.key_value in  ('A')  AND f.keyword_no = 403
     AND g.key_value in  ('Individual')  AND g.keyword_no = 402

     

    Thanks in advance.

     




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

  • Matt -

    I would probably end up using view and a couple of custom elements - even if it pulls the exact same information as the standard criteria element, this would force the extra join that you would be looking for.

    Hope that makes sense,

    Heather