I am trying to make an extremely simple query where I filter the result based on the result of two columns. Ex: SELECT x, y FROM coordinates WHERE x &gt; y;  So far I didn't found any example of how to compare dynamic fields in a SOQL filter query. The result is: Unknown error parsing query. Any idea of how to do it on SOQL?
6846
I think I may be hitting some sort of SOQL limitation in the WHERE clause. I am trying to return fields from two parent objects, after comparing two date fields on both Objects.  The goal is to have a list of contacts with associated opportunity fields where the opportunity date field is equal to some contact field.     NOTE: We have a custom junction between Opportunity and Contact named "Opportunity_Contact__c" due to the limits on the standard OCR sObj.   Specifically:  SELECT NAME, Con_Custom_Date__c,   (SELECT Opportunity__r.Name FROM Opportunity_Contacts__r     WHERE Contact__r.Con_Custom_Date__c = Opportunity__r.Opp_Custom_Date__c) FROM Contact   This returns a parsing error. However, if I try switching the query to something like:  SELECT NAME, Con_Custom_Date__c,   (SELECT Opportunity__r.Name FROM Opportunity_Contacts__r     WHERE Contact__r.Con_Custom_Date__c = TODAY and Opportunity__r.Opp_Custom_Date__c = TODAY) FROM Contact   This works. So the date fields are working and I am able to use them in the WHERE clause. However, when I compare one field directly to the other, I get a parsing error..  Why would   WHERE Contact__r.Con_Custom_Date__c = TODAY and Opportunity__r.Opp_Custom_Date__c = TODAY   work while   WHERE Contact__r.Con_Custom_Date__c = Opportunity__r.Opp_Custom_Date__c   triggers a parsing error?  Thanks!
97214
I'm trying to do a basic "OR" on three fields using a hibernate criteria query.  Example  class Whatever{  string name;  string address;  string phoneNumber; }   I'd like to build a criteria query where my search string could match "name" or "address" or "phoneNumber".
11195
I found an example in the  for Dynamic LINQ that allows you to use a sql-like string (e.g. OrderBy("Name, Age DESC")) for ordering. Unfortunately, the method included only works on IQueryable&lt;T&gt;. Is there any way to get this functionality on IEnumerable&lt;T&gt;?
98204
During my work with databases I noticed that I write query strings and in this strings I have to put several restrictions in the where-clause from a list/array/collection. Should look like this:  select * from customer  where customer.id in (34, 26, ..., 2);   You can simplify this by reducing this to the question that you have collection of strings and want to create a comma-separated list of this strings in just one string.  My approach I have used so far is something like that:  String result = ""; boolean first = true; for(String string : collectionOfStrings) {     if(first) {         result+=string;         first=false;     } else {         result+=","+string;     } }   But this is as you can see very ugly. You cannot see what happens there on the first look, especially when the constructed strings (like every SQL query) is getting complicated.  What is your (more) elegant way?
73409
I am trying to set multiple definition queries for one layer based on one field using python.  ie.  I have a City layer with a field that holds the city name.  I want a copy of the layer in an MXD with the Definition query set for each value in the City field.  So essentially, I have one source layer, with a copy of the layer as many times as there are values in the City field.  The query would look like this: CITY = 'Atlanta'
8596
I need to do a LINQ2DataSet query that does a join on more than one field (as  var result = from x in entity join y in entity2         on x.field1 = y.field1  and            x.field2 = y.field2   I have yet found a suitable solution (I can add the extra constraints to a where clause, but this is far from a suitable solution, or use  solution, but that assumes an equijoin).  Is it possible in LINQ to join on multiple fields in a single join?  EDIT  var result = from x in entity              join y in entity2              on new { x.field1, x.field2 } equals new { y.field1, y.field2 }   is the solution I referenced as assuming an equijoin above.  Further EDIT  To answer criticism that my original example was an equijoin, I do acknowledge that, My current requirement is for an equijoin and I have already employed the solution I referenced above.  I am, however, trying to understand what possibilities and best practices I have / should employ with LINQ. I am going to need to do a Date range query join with a table ID soon, and was just pre-empting that issue, It looks like I shall have to add the date range in the where clause.  Thanks, as always, for all suggestions and comments given
93643
I'm having some difficulty when using a Logical OR in a WFS query to get multiple postcodes. This code works fine when it's only 1 PropertyIsEqualTo filter, but when I wrap the OR around more than one PropertyIsEqualTo filter I get an exception.   POST http://intranet.nottscc.gov.uk/maps/wfs HTTP/1.1 User-Agent: Fiddler Content-Type: text/xml Host: intranet.nottscc.gov.uk Content-Length: 1875 Expect: 100-continue  &lt;wfs:GetFeature service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ncc="http://nottinghamshire.gov.uk" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"&gt; &lt;wfs:Query typeName="ncc:OSCodepoint_15KM"&gt; &lt;wfs:PropertyName&gt;ncc:FORMAT1&lt;/wfs:PropertyName&gt; &lt;wfs:PropertyName&gt;ncc:EASTING&lt;/wfs:PropertyName&gt; &lt;wfs:PropertyName&gt;ncc:NORTHING&lt;/wfs:PropertyName&gt; &lt;ogc:Filter&gt;   &lt;ogc:OR&gt;     &lt;ogc:PropertyIsEqualTo&gt;       &lt;ogc:PropertyName&gt;ncc:FORMAT3&lt;/ogc:PropertyName&gt;       &lt;ogc:Literal&gt;NG156LR&lt;/ogc:Literal&gt;     &lt;/ogc:PropertyIsEqualTo&gt;     &lt;ogc:PropertyIsEqualTo&gt;       &lt;ogc:PropertyName&gt;ncc:FORMAT3&lt;/ogc:PropertyName&gt;       &lt;ogc:Literal&gt;NG163GP&lt;/ogc:Literal&gt;     &lt;/ogc:PropertyIsEqualTo&gt;     &lt;ogc:PropertyIsEqualTo&gt;       &lt;ogc:PropertyName&gt;ncc:FORMAT3&lt;/ogc:PropertyName&gt;       &lt;ogc:Literal&gt;NG158AY&lt;/ogc:Literal&gt;     &lt;/ogc:PropertyIsEqualTo&gt;     &lt;ogc:PropertyIsEqualTo&gt;       &lt;ogc:PropertyName&gt;ncc:FORMAT3&lt;/ogc:PropertyName&gt;       &lt;ogc:Literal&gt;NG171ER&lt;/ogc:Literal&gt;     &lt;/ogc:PropertyIsEqualTo&gt;       &lt;/ogc:OR&gt;     &lt;/ogc:Filter&gt;   &lt;/wfs:Query&gt; &lt;/wfs:GetFeature&gt;   This is the Error message I get.  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ows:ExceptionReport version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://intranet.nottscc.gov.uk/maps/schemas/ows/1.0.0/owsExceptionReport.xsd"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows"&gt;   &lt;ows:Exception exceptionCode="NoApplicableCode"&gt;     &lt;ows:ExceptionText&gt;Error occurred getting features Invalid fid filter provides, has no fids inside Invalid fid filter provides, has no fids inside&lt;/ows:ExceptionText&gt;   &lt;/ows:Exception&gt; &lt;/ows:ExceptionReport&gt;   I'm using GeoServer to process the query.   Any help is much appreciated.
25015
This is the problem I'm seeing:      Error - Unable to parse query string for function QUERY parameter 2: NO_COLUMND     The formula is of the form:  =query(importange("...", "Sheet!A:V"), "select D where V = 1", 1)   I imported data from another sheet, I want this current sheet to display column D when Column V is 1.  Is there a different way rather than my current formula?
24575
Using QGIS 2.16.2, I can successfully select records from a shapefile attribute table using the following expression:  left("start_time", 10) = '2015-08-01'   Please note that start_time is a string field.  However, when I copy and paste the same expression into the shapefile's Layer Properties>General>feature filter>Query Builder I get the following error:    I would expect that the same expression would work everywhere in QGIS.  What am I doing wrong?
89546
I'm trying to create a new field based in another (sum field)  SELECT sum(price) AS old_price,    old_price+100 AS total_price FROM sales   This returns Unknown column 'old_price' in 'field list'  sum is just a example, my real issue is to use with a select inside this field  What am I doing wrong?  Thanks.  --edit I've used variables to reuse the alias, updated code:  SELECT @old_price := sum(price) AS old_price,    @old_price+100 AS total_price FROM sales   If you think that it is not a good practice, tell me.
16003
We're working on a Log Viewer. The use will have the option to filter by user, severity, etc. In the Sql days I'd add to the query string, but I want to do it with Linq. How can I conditionally add where-clauses?
63457
Is there a way to mix LIKE operator with IN ? Something Like  SELECT Id FROM Account WHERE Name LIKE IN:nameList   Where nameList is list of String? Is this is possible ? (I can make a dynamic query by doing OR with all the elements, but was looking for a more elegant way to do this)
58214
I'm trying to create a query activity in order to show, from a Data Extension, only the last 5 articles ids. I tried with the formula ORDER BY xxx DESC LIMIT 0,5 as in SQL but it is not working and it is returning this exception:     The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified   How can I use ORDER BY in a Data Extension?
33318
I'm performing in Drupal 8 an entity query that searches for nodes that have not been changed since x days, where x is a numeric node field (node.field_days). So I would like to perform a query like:  $query = \Drupal::entityQuery("node")   -&gt;condition('changed', strtotime('-node.field_days days'), '&lt;=');   I know that condition takes as value a string and not a db column, but is it possible to use entity query with a dynamic value?
9378
Cannot sort on a soql-request in a custom meta data type. When i perform SELECT .. FROM x__mdt WHERE ... ORDER BY x. Then field x cannot be numeric to get a correct order. Change it to a string-field ordering works ok. Playing with ASC/DESC makes no difference!
57464
I'm looking for a way to do a SOQL request to get a Task record, but I keep ending up with this error:     Error: Compile Error: No such column 'What' on entity 'Task'. If you   are attempting to use a custom field, be sure to append the '__c'   after the custom field name. Please reference your WSDL or the   describe call for the appropriate names. at line 59 column 25   The 'What' field is labeled as 'Related To' (it's a standard field of the Activity object).  Here's my request generating this error:  Task task = [SELECT Type FROM Task WHERE What = :this.person.Id];   Thanks for your solutions.
13630
I have a simple query:  SELECT u_name AS user_name FROM users WHERE user_name = "john";   I get Unknown Column 'user_name' in where clause.  Can I not refer to 'user_name' in other parts of the statement even after select 'u_name as user_name'?