<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Query Database</title><link>https://community.appian.com/discussions/f/process/17558/query-database</link><description>Hi, 
 
 I am trying to run this querry in query database but getting an error: 
 
 SELECT ID,PRIORITY,CREATION,DURATION,FIRM_GROUP,IS_SCHEDULED,STATUS FROM XYZ_VIEW WHERE IS_TEMP=1 AND STATUS NOT IN (&amp;#39;Closed&amp;#39;, &amp;#39;Complete&amp;#39;, &amp;#39;Cancelled&amp;#39;) AND IS_SCHEDULED</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Query Database</title><link>https://community.appian.com/thread/87008?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 14:41:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3a245c3-7ddc-45f7-a4c9-a3bb994f1886</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;First, I agree with the other suggestions in the thread regarding creating a view for your query, attach a CDT to it (only need one) and utilize a!queryEntity() to retrieve data.&lt;/p&gt;
&lt;p&gt;However, if for some reason it is required to use a Query DB node, the way we used to do this in legacy versions of Appian was to use INSTR (Oracle) or CHARINDEX (MSSQL) &lt;a href="/discussions/f/data/22102/problem-setting-sql-sentence-select-in-in-query-database"&gt;such as the example I posted in this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/87006?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 14:05:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0ac55e81-bb61-46bf-bf68-9cf6c9b920c4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;It&amp;#39;s super easy to create a View to do the Join you need, with accompanying CDT / data store entity, and then query that.&amp;nbsp; This is super standard practice.&amp;nbsp; And in 21.2+ you also have the option to use record type relationships.&amp;nbsp; Either of these approaches will be much easier than trying to deal with directly using SQL in a process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/87002?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 13:30:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:17abf276-033c-421b-93e2-c87f7ee14b6f</guid><dc:creator>Furman</dc:creator><description>&lt;p&gt;I can&amp;#39;t agree that using query Entity is easier as there is join in SQL so I would have to create 2 datatypes then 2 query entities and then use one query entity results as filter criteria for second query entity. At the end i would have to join results based on the id column to have it one object.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/83801?ContentTypeID=1</link><pubDate>Mon, 19 Jul 2021 14:35:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4836192e-c1cf-46b5-8ee8-5a16360dfdb9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I would create a view in DB and query it using queryEntity().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/83798?ContentTypeID=1</link><pubDate>Mon, 19 Jul 2021 14:26:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e96722b3-1d46-4ae7-bf88-c7057b02ed24</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Really the same question applies here. This is a simple query - can you use a!queryEntity() or a!queryRecordType() instead of the Query Database Node? Those functions are much easier to work with and should support the query you suggested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/83797?ContentTypeID=1</link><pubDate>Mon, 19 Jul 2021 14:09:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5b7e5732-37b2-429b-8a98-f41206610237</guid><dc:creator>Furman</dc:creator><description>&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want to open new question but I have same problem.&lt;/p&gt;
&lt;p&gt;I need to provide in criteria dynamically but I get no results. There is no error and no data. In data section the in criteria are &lt;strong&gt;definded as :&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;=&amp;quot;&amp;#39;abc1&amp;#39;, &amp;#39;ddddd33333&amp;#39;&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;part of sql:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and c.userid in ( ac!sqlMailboxes )&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;full sql:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;select c.userid as Milbox, &lt;br /&gt;cast(a.Creationtime as date) as RFDate,&lt;br /&gt;count(a.uniqueid) as NoOfFaxes&lt;br /&gt;from users c&lt;br /&gt;join documents a&lt;br /&gt;on c.handle = a.ownerid&lt;br /&gt;where&amp;nbsp;c.userid in ( ac!sqlMailboxes )&lt;br /&gt;group by c.userid, &lt;br /&gt;cast(a.Creationtime as date)&lt;/p&gt;
&lt;p&gt;Same query run on SQL Server return data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to deliver this in criteria based on string array variable ?&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/69180?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 12:21:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:87c87d90-8625-4038-8b49-02545f0d86b6</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Agreed - this is a pretty straightforward query that can easily be done using a!queryEntity(). I highly recommend only using the Query Database node when you have extremely complex SQL. The Query Database node doesn&amp;#39;t return the data as a CDT, which makes it more difficult to work with in a process. Plus, you can use a!queryEntity() in any expression, while the Query Database&amp;nbsp;Smart Service only works in a process model.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/69176?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 07:57:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9de0a7a3-092d-4680-9ffe-dbb8afc1d66c</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Is there a reason for not using queryEntity?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database</title><link>https://community.appian.com/thread/69169?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 06:10:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b890ae6d-ee32-4a68-a5cc-de5d8cf8462f</guid><dc:creator>ankitab0001</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/apoorvam0001"&gt;apoorvam&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please remove the semi- colon at the end of the query statement.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>