<?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 Need help with SQL SELECT in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184064#M49096</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on the database, in Oracle you can use nvl(). Also if you use sum() you will need a group by as well&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Sep 2010 14:14:06 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-09-01T14:14:06Z</dc:date>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184063#M49095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need help with a SQL SELECT statement - here it is:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;SQL SELECT creationdate as "Order created",&lt;BR /&gt; id_case,&lt;BR /&gt; model as "WL_model",&lt;BR /&gt; "model_name_long",&lt;BR /&gt; "model_name_short",&lt;BR /&gt; service,&lt;BR /&gt; status,&lt;BR /&gt; "subsidiary_registered",&lt;BR /&gt; repairdate&lt;BR /&gt;&lt;BR /&gt;FROM "_lordwh_global".dbo."v_case";&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Now i want to replace the id_case with something like that:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;IF(ISNULL(Sum(id_case)),0,Sum(id_case))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;How can I implement such a function in the SQL select?&lt;BR /&gt;I want to replace all NULL-values with a 0 from the id_case.&lt;/P&gt;&lt;P&gt;Thanks for help!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 13:01:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184063#M49095</guid>
      <dc:creator />
      <dc:date>2010-09-01T13:01:47Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184064#M49096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on the database, in Oracle you can use nvl(). Also if you use sum() you will need a group by as well&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 14:14:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184064#M49096</guid>
      <dc:creator />
      <dc:date>2010-09-01T14:14:06Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184065#M49097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;2 ideas:&lt;/P&gt;&lt;P&gt;a) What is your database? For example Oracle offers a function (nvl) which does exactly what you want: (SELECT nvl(id_case,0) ID from ... ).&lt;BR /&gt;So check the SQL functions for your data.&lt;/P&gt;&lt;P&gt;b) combine the SQL select with a load statement:&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;if(isnull(id_case),0,id_case) as id_case,&lt;BR /&gt;&amp;lt;... other stuff ...&amp;gt;&lt;BR /&gt;;&lt;BR /&gt;SQL SELECT&lt;BR /&gt;id_case,&lt;BR /&gt;&amp;lt;... other stuff ...&amp;gt;&lt;BR /&gt;FROM ...;&lt;/P&gt;&lt;P&gt;hth,&lt;BR /&gt;Thilo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 14:14:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184065#M49097</guid>
      <dc:creator />
      <dc:date>2010-09-01T14:14:38Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184066#M49098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;That's exactly what i needed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 14:21:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184066#M49098</guid>
      <dc:creator />
      <dc:date>2010-09-01T14:21:15Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184067#M49099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MS SQL Server has the COALESCE function, as in&lt;/P&gt;&lt;PRE style="margin:0px;"&gt;&lt;I&gt;COALESCE (id_case, 0)&lt;/I&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;which will return 0 is id_case is null, or id_case if it is not.&lt;/P&gt;&lt;P&gt;But if you want to get SUM(id_case) you will probably want some sort of GROUP BY clause (no matter what database server you're using).&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 14:23:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184067#M49099</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2010-09-01T14:23:09Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184068#M49100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now I'm having another Problem.&lt;/P&gt;&lt;P&gt;Because of the Data from column SR_Number, wheres no Data in column id_case, QlikView is joining the two tables and fills in the emtpy space where column id_case has no values where SR_Number has.&lt;/P&gt;&lt;P&gt;I did this if-clause in the Load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if(ISNULL(id_case),0,1) as id_case_null&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I can only select the 1 (which means the id_case column has values and is NOT NULL), but i cant select the 0 (which should show only the data when theres no value (NULL) in id_case).&lt;/P&gt;&lt;P&gt;So, I didn't solve my problem &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 08:00:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184068#M49100</guid>
      <dc:creator />
      <dc:date>2010-09-02T08:00:33Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184069#M49101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi HofbauerAn,&lt;/P&gt;&lt;P&gt;Try this and let me know the outcome:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;isnull(Sum(id_case),0) as id_case&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 08:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184069#M49101</guid>
      <dc:creator />
      <dc:date>2010-09-02T08:09:49Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184070#M49102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rikab,&lt;/P&gt;&lt;P&gt;here's what I wrote in the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;load&lt;BR /&gt; *,&lt;BR /&gt; ISNULL(SUM(id_case),0) AS id_case,&lt;BR /&gt; 1;&lt;BR /&gt;SQL SELECT creationdate as "Order created",&lt;BR /&gt; id_case,&lt;BR /&gt; model as "WL_model",&lt;BR /&gt; "model_name_long",&lt;BR /&gt; "model_name_short",&lt;BR /&gt; service,&lt;BR /&gt; status,&lt;BR /&gt; "subsidiary_registered",&lt;BR /&gt; repairdate&lt;BR /&gt;&lt;BR /&gt;FROM "_lordwh_global".dbo."v_case";&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;I get the following error:&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;Error in expression:&lt;BR /&gt;IsNull takes 1 parameter&lt;BR /&gt;&lt;BR /&gt;load&lt;BR /&gt; *,&lt;BR /&gt; ISNULL(SUM(id_case),0) AS id_case,&lt;BR /&gt; 1&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 08:23:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184070#M49102</guid>
      <dc:creator />
      <dc:date>2010-09-02T08:23:19Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184071#M49103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You probably mean&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;load &lt;STRONG&gt;If(Len(id_case) &amp;gt; 0, 1, 0) AS id_case, // EDIT: ended correctly with ','&lt;/STRONG&gt; model as "WL_model", "model_name_long", "model_name_short", service, status, "subsidiary_registered", repairdate;SQL SELECT creationdate as "Order created", id_case, model as "WL_model", "model_name_long", "model_name_short", service, status, "subsidiary_registered", repairdateFROM "_lordwh_global".dbo."v_case";&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I used "Len(id_case) &amp;gt; 0" on purpose, as I've found that sometimes isnull doesn't behave as expected.&lt;/P&gt;&lt;P&gt;If you only want to load those records where id_case is not null, you may do something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;load *WHERE Len(id_case) &amp;gt; 0;SQL SELECT creationdate as "Order created", id_case, model as "WL_model", "model_name_long", "model_name_short", service, status, "subsidiary_registered", repairdateFROM "_lordwh_global".dbo."v_case";&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 09:03:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184071#M49103</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-09-02T09:03:41Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184072#M49104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another Script Error again:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Syntax error, missing/misplaced FROM:&lt;BR /&gt;load&lt;BR /&gt; *,&lt;BR /&gt; IF(Len(id_case) &amp;gt; 0, 1, 0)) AS id_case,&lt;BR /&gt; 1&lt;BR /&gt;load&lt;BR /&gt; *,&lt;BR /&gt; IF(Len(id_case) &amp;gt; 0, 1, 0)) AS id_case,&lt;BR /&gt; 1&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Like I said before - I only want to show the data in the table, where's no value in id_case.&lt;BR /&gt;Thank you very much for your help.&lt;BR /&gt;I really appreciate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 09:13:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184072#M49104</guid>
      <dc:creator />
      <dc:date>2010-09-02T09:13:56Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184073#M49105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, I fix it now&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;load If(Len(id_case) &amp;gt; 0, 1, 0) AS id_case, model as "WL_model", "model_name_long", "model_name_short", service, status, "subsidiary_registered", repairdate;SQL SELECT creationdate as "Order created", id_case, model as "WL_model", "model_name_long", "model_name_short", service, status, "subsidiary_registered", repairdate FROM "_lordwh_global".dbo."v_case";&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Anyway, that error is usually because of a missing "," or ";" depending on the type of load you are doing.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 09:30:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184073#M49105</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-09-02T09:30:56Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184074#M49106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. It's working now, but I still can't get my result I want.&lt;BR /&gt;QlikView won't let me select the NULL values ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 09:51:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184074#M49106</guid>
      <dc:creator />
      <dc:date>2010-09-02T09:51:33Z</dc:date>
    </item>
    <item>
      <title>Need help with SQL SELECT</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184075#M49107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do otherwise, and use the where clause to select all null values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;WHERE Len(id_case) = 0&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;If this doesn't work, you will have to check how your database works with null values, and how your odbc/driver returns them.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 09:55:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-SQL-SELECT/m-p/184075#M49107</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-09-02T09:55:29Z</dc:date>
    </item>
  </channel>
</rss>

