<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic joining two table with a OR condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415896#M95123</link>
    <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to achieve MS SQL server like join condition with the OR clause in Qliksense.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, i want to full outer join two tables either with EmployeeID or EmailAddress. Meaning if EmployeeID is missing or null then join with EmailAddress and vise versa.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example in SQL server.&lt;/P&gt;
&lt;P&gt;How can i achieve this in Qlik ?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;on s.EmployeeID = f.EmployeeID or s.EmailAddress = f.EmailAddress&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Select s.EmployeeID,s.EmailAddress,s.Module,s.Name,
f.EmployeeID as FinanceEmpid, f.EmailAddress as FinanceEMailID, f.Module as FinanceModule , f.name as Financename
 from
sales as s 
full outer join
finance as f
on s.EmployeeID = f.EmployeeID or s.EmailAddress = f.EmailAddress&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Feb 2024 10:19:35 GMT</pubDate>
    <dc:creator>Kalkumar</dc:creator>
    <dc:date>2024-02-07T10:19:35Z</dc:date>
    <item>
      <title>joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415896#M95123</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to achieve MS SQL server like join condition with the OR clause in Qliksense.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, i want to full outer join two tables either with EmployeeID or EmailAddress. Meaning if EmployeeID is missing or null then join with EmailAddress and vise versa.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example in SQL server.&lt;/P&gt;
&lt;P&gt;How can i achieve this in Qlik ?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;on s.EmployeeID = f.EmployeeID or s.EmailAddress = f.EmailAddress&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Select s.EmployeeID,s.EmailAddress,s.Module,s.Name,
f.EmployeeID as FinanceEmpid, f.EmailAddress as FinanceEMailID, f.Module as FinanceModule , f.name as Financename
 from
sales as s 
full outer join
finance as f
on s.EmployeeID = f.EmployeeID or s.EmailAddress = f.EmailAddress&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 10:19:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415896#M95123</guid>
      <dc:creator>Kalkumar</dc:creator>
      <dc:date>2024-02-07T10:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415933#M95131</link>
      <description>&lt;P&gt;You can join twice - once for each key - and then reload the table to combine the joined fields.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Employees:
NoConcatenate Load 
	RecNo() as EmployeeID,
    RecNo() &amp;amp; '@mail.com' as EmailAddress
AutoGenerate 10;

Data:
NoConcatenate Load
    If(Mod(EmployeeID, 2) = 1, EmployeeID) as EmployeeID,
    If(Mod(EmployeeID, 2) = 0, EmailAddress) as EmailAddress,
    If(Mod(EmployeeID, 2) = 1, 'ID', 'Email') as JoinedFrom
Resident Employees;



Join(Employees) Load Distinct
	EmployeeID,
    JoinedFrom as JoinedFromID
Resident Data;

Join(Employees) Load Distinct
	EmailAddress,
    JoinedFrom as JoinedFromEmail
Resident Data;

Rename Table Employees to Employees_Old;

Employees:
NoConcatenate Load
	EmployeeID,
    EmailAddress,
    If(IsNull(JoinedFromID), JoinedFromEmail, JoinedFromID) as JoinedFrom
Resident Employees_Old
Where not IsNull(EmployeeID);

Drop Tables Employees_Old, Data;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Feb 2024 11:12:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415933#M95131</guid>
      <dc:creator>LRuCelver</dc:creator>
      <dc:date>2024-02-07T11:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415941#M95133</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/117062"&gt;@Kalkumar&lt;/a&gt;&amp;nbsp;In general, I won't encourage joining the same table in multiple times due to permance stability. Instead, I would strongly advice to write the same query in Qlik and just load as below?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'Your connection name in Qlik sense against Database';

SQL Select s.EmployeeID,s.EmailAddress,s.Module,s.Name,
f.EmployeeID as FinanceEmpid, f.EmailAddress as FinanceEMailID, f.Module as FinanceModule , f.name as Financename
 from
sales as s 
full outer join
finance as f
on s.EmployeeID = f.EmployeeID or s.EmailAddress = f.EmailAddress&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 11:21:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415941#M95133</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2024-02-07T11:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415988#M95137</link>
      <description>&lt;P&gt;I hope this will work&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales:
Load EmployeeID,
     EmailAddress,
     Module,
     Name,
     if(LEN(TRIM(EmployeeID))=0, EmailAddress, EmployeeID) as %Key
from sales
JOIN 
Finance:
Load EmployeeID as FinanceEmpid, 
     EmailAddress as FinanceEMailID, 
     Module as FinanceModule, 
     name as Financename,
     if(LEN(TRIM(EmployeeID))=0, EmailAddress, EmployeeID) as %Key
from finance&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:47:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2415988#M95137</guid>
      <dc:creator>Nagaraju_KCS</dc:creator>
      <dc:date>2024-02-07T12:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2416150#M95147</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; EmployeeID, EmailAddress, Module, Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 1, john@example.com, Sales, John&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2, jane@example.com, Sales, Jane&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Left Join (Table)&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; EmployeeID, EmailAddress, Module, Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 1, jane@example.com, Finance, Jane&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2, sam@example.com, Finance, Sam&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; s.EmployeeID as Sales_EmployeeID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; s.EmailAddress as Sales_EmailAddress,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; s.Module as Sales_Module,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; s.Name as Sales_Name,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; f.EmployeeID as Finance_EmployeeID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; f.EmailAddress as Finance_EmailAddress,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; f.Module as Finance_Module,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; f.Name as Finance_Name&lt;/P&gt;
&lt;P&gt;RESIDENT Table&lt;/P&gt;
&lt;P&gt;WHERE Match(s.EmployeeID, f.EmployeeID) or Match(s.Email&lt;/P&gt;
&lt;P&gt;Address, f.EmailAddress);&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 16:23:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2416150#M95147</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2024-02-07T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: joining two table with a OR condition</title>
      <link>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2423197#M95880</link>
      <description>&lt;P&gt;All,&amp;nbsp; am following an approach of link able to achieve this.&lt;BR /&gt;This link table will be resident of Finance and Sales table and will have the columns upon which I ideally wanted to joined the these table in SQL server.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is working as expected.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you see any cons with this approach?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 11:08:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/joining-two-table-with-a-OR-condition/m-p/2423197#M95880</guid>
      <dc:creator>Kalkumar</dc:creator>
      <dc:date>2024-02-25T11:08:55Z</dc:date>
    </item>
  </channel>
</rss>

