Questions tagged [where-clause]

A syntactic form in functional languages used to bind a value to a name in a local scope. Similar, but not identical to, let.

where-clause
Filter by
Sorted by
Tagged with
0 votes
1 answer
17 views

Search Apple Numbers Table where duplicates exist using multiple criteria

How do you perform a Lookup in Apple Numbers using multiple where conditions? Example, I want to know the $ Complete for LOB == Product A, Feature == New Function, and Activity == TaskC. And if % ...
emie's user avatar
  • 289
-1 votes
0 answers
20 views

Using JOIN ON with AND conditions to further limit results

Using T-SQL, I was messing around converting implicit joins to explicit joins and mistakenly left part of the compound WHERE in the explicit join without including WHERE. I was surprised by the result;...
Doby's user avatar
  • 19
0 votes
0 answers
27 views

How to do calculation in SQL BigQuery?

I have a dataset of an e-commerce company. I am trying to solve the following question in BigQuery: Get the % increase in the cost of orders from year 2017 to 2018 (include months between Jan to Aug ...
Dharminder Singh's user avatar
1 vote
2 answers
51 views

Why does LEFT join omits a line from the left side, like INNER join

can you tell me why in the following select the LEFT join is working as INNER join? SELECT FROM @it_selected_data AS selected LEFT JOIN zkrh_scmt_invh AS invh ON invh~ebeln = ...
ekekakos's user avatar
  • 585
0 votes
0 answers
14 views

Maximo IBM Report filter last 6 Months of Work orders from REPORTDATE

I need your help, I don't know if it is possible, but I need to create a report that shows all the types of work orders created in the system from the reported date, of all the WO statuses different ...
AmazingBand Proyect's's user avatar
0 votes
1 answer
24 views

cannot reshape array of size 4 into shape (4,4) in DataFrame where clause

Can anyone explain to me what is going on? Here's the piece of code. If I have the DataFrame of precisely length 4, the statement in the try clause throws an exception. If I make the dataframe of any ...
user23873134's user avatar
0 votes
1 answer
52 views

Databricks not displaying correct output

In Azure databricks I am applying a filter to show the data where Region column has value 'weu'. display(df.where(col("Region") == 'weu')) But the output dataframe I am getting has Region ...
MUHAMMAD UMER's user avatar
0 votes
0 answers
27 views

SQL Query not includes valid result in Left Join with Where Not Equal To [duplicate]

I have a SQL query which does not perform as expected and returns incomplete results. In the query below, valid t1 rows are not included in the query results if there are no matching ids in t2. Select ...
TheCN's user avatar
  • 1
0 votes
0 answers
67 views

How is the AND clause used in mysql queries?

I have the below code that works fine up to the AND clause. The portion of code below that with a SELECT *, in front of the ( 3959, works fine too. I tried putting the AND clause to marry them ...
Don's user avatar
  • 25
0 votes
1 answer
27 views

SQL : unrecognized name

Unrecognized name: year at [6:7] SELECT EXTRACT(YEAR FROM starttime) AS year, COUNT (*) AS number_of_rides FROM bigquery-public-data.new_york.citibike_trips WHERE year IN (2013,2014) ...
Amirul Fakhruddin's user avatar
-2 votes
2 answers
48 views

SQL Error in stacked WHERE statements using WHERE NOT EXISTS

I'm having a reoccurring error in my SQL statement, and I cannot figure out how to fix it. The ERROR: syntax error at or near "WHERE" is not very helpful as well. This is the code snippet ...
bKaestle's user avatar
1 vote
1 answer
56 views

force order of conditions executions -- where clause

Is there any way to force order of conditions executions (in where clause) I want force mssql filter rows ISJSON(Data)=1 first, than JSON_VALUE... later I have this query: SELECT *, ISJSON(Data)...
mordechai's user avatar
  • 839
-1 votes
1 answer
74 views

Why is WHERE being used to JOIN the same table

I have been taking a class with Coursera. There is a query that is incorporating a subquery in the SELECT clause. I understand about 90% of the query; however, I cannot figure out why we need to use ...
Rafael Gutierrez's user avatar
0 votes
0 answers
9 views

Merging data frames based on values from two column in R

I have 11 data frames that I am trying to merge/join together. I want to join them based on a Id value and a date. Each table has 31 days (a month) per Id value. I would be able to do this in SQL ...
JakeWillMoran's user avatar
0 votes
0 answers
11 views

SQL Functions Overflow

I'm having trouble figuring out which SQL function allows me to locate a specific table in a query. I can't figure out if it's the WHERE or the FROM clause. I have trying to use both, but for someone ...
Scody's user avatar
  • 1
-2 votes
1 answer
58 views

SQL: USING TIMESTAMP in WHERE CLAUSE in SQL [closed]

I need to filter the results to see 2023 data only. But my WHERE clause also captures data in 2024 and I'm not sure what's causing this issue.. Anyone know what I need to fix in order to just view ...
Crystal 's user avatar
0 votes
1 answer
26 views

Using PowerBI to connect to a Python Script and running SQL within the Python Script using PANDASQL and SQLDF

I am using Power BI to connect to a Python Script. Within this Python Script I am utilizing PandaSql and SQLDF. I am taking this approach as I need to manipulate an excel file with SQL queries. ...
user23394390's user avatar
0 votes
1 answer
72 views

Nice and short sql query for ‘one-year-one-column’ table

I have one table that contains data for several years, example is here: year value fruit 2021 101 apples 2021 102 bananas 2021 103 pears 2021 104 raspberries 2021 105 strawberries 2022 201 ...
code_beginner's user avatar
0 votes
0 answers
8 views

HBM file class definition where clause not getting appended when joining with other entity

we have a hbm file with class definition as . Now when the entity is getting called in query the where clause in class definition in hbm gets appended automatically. But when we join the entity with ...
Akash Derasree's user avatar
-1 votes
2 answers
66 views

Understanding a weird SQL clause

While learning some SQL, I stumbled upon this seemingly incorrect clause: SELECT item FROM inventory WHERE 20 >= price < 500; The query does not result what was intended and should look like ...
pyte's user avatar
  • 49
0 votes
1 answer
78 views

SAS Studio - How to utilise nested WHERE conditions for string searches

As part of a bigger project, I am trying to search through multiple tables for common columns. However I dont know the number of tables, number of columns or the exact names of columns so I cannot ...
sassane's user avatar
  • 55
0 votes
1 answer
75 views

Top-n in primitive database

I use a GIS database called a File Geodatabase that has minimal SQL support. Does not support: Window Functions TOP, LIMIT, FETCH FIRST or ROWNUM Correlated subqueries Does support: Scalar ...
User1974's user avatar
  • 368
0 votes
3 answers
74 views

Filtering after having used a SQL windowing function

Why can't I do as below, and what is the best alternative? SELECT year, category, name, COUNT() OVER (PARTITION BY name) AS count FROM nobel_prizes WHERE ...
A_Weierstrass's user avatar
0 votes
1 answer
53 views

How to filter a laravel collection with where clause on date values?

I have a periods table that has: a start column of type date an end column of type date a current column of type boolean (only one period has this current column set to 1) Then I have an events table ...
Meaulnes's user avatar
  • 449
-1 votes
1 answer
47 views

WHERE with several ANDed conditions filters as expected but using just one of them unexpectedly returns all rows

I tried to return some of the rows in table service: SELECT ps.post_name as post, c.cname, p.place, s.date_from, s.date_to, e.emp_name as employee, s.court, s.place FROM `service` s INNER JOIN `...
Kabilan S's user avatar
0 votes
0 answers
11 views

How can I use SQL to find results with a dynamic integer field?

| ID | Status | I am searching a table with a status field that is an integer. I need to find certain values with the dynamic status. The status can be 0 or 0,1 or 1,3 or 0,1,3 etc. I get an error ...
Morgan Woods's user avatar
1 vote
1 answer
62 views

what can i to cancel the gorm where

i have a gorm query with many where,when i exec the final query, i want to cancel the previous where,what can i do i try to copy the base query,but it dose not work, like this db.where().where().where(...
simon_liu's user avatar
1 vote
1 answer
67 views

SQL query using variable in the where clause for exclusions

I am using dbWarden (https://www.sqlservercentral.com/articles/dbwarden-a-free-sql-server-monitoring-package-3) for SQL monitoring and would like for certain procs to be excluded from the "long ...
FaatFire's user avatar
1 vote
1 answer
109 views

WHERE condition to filter JSON data in nested object or array

I have a table in a PostgreSQL database CREATE TABLE js.orders ( id serial NOT NULL PRIMARY KEY, info json NOT NULL ) containing 6 rows of JSON data: select * from js.orders; returns id | ...
Calcutta's user avatar
  • 1,059
1 vote
2 answers
78 views

LINQ equivalent of keyset based pagination in postgres

I have a postgresql query that does pagination using a keyset-based approach. SELECT * FROM public.values_with_variable_view WHERE ( timestamp, id) > ('2024-01-04 01:12:09.267335+00',1996) ORDER BY ...
Amit Kumar's user avatar
0 votes
0 answers
29 views

how to correct pass parameter/values to whereRaw

i need to parametrize a db table and field in a whereRaw with a JsonExtract: $query = $query->whereRaw("JSON_EXTRACT(?, ? ) = ? ", [ "a.tags",'$.' . $orgKey, $orgValue]);...
JahStation's user avatar
0 votes
0 answers
28 views

How to "save" a long query for reuse in a where clause? Is it even necessary?

I want to select some elements from table1 using some data from table2 and table3 with conditions that depend on a processing-cost-intensive query in table3 which I have to perform twice. The question ...
rosecabbagedragon's user avatar
-1 votes
1 answer
97 views

LEFT JOIN … WHERE returning less rows than LEFT JOIN ON + AND

It seems that I totally fail to understand these query results (a PostgreSQL DB): a) Rows filtered only after joining them: SELECT COUNT(*) FROM apidata.info x LEFT JOIN compdata.info a ON x.info =...
pinjaliina's user avatar
1 vote
2 answers
37 views

Return a record with a maximum value

For context, I am practicing and using a table with a load of international footballing results. Table layout is as follows Date, Home_team, away_team, home_score, away_score I am attempting to filter ...
David Capuano's user avatar
-1 votes
3 answers
113 views

Condition for subqueries columns in SQL query

I am executing a SQL query with sub queries and in that I want condition greater than zero of that subqueries. Here is my query: SELECT Ledger.Grup, ledger.CompanyName, ledger.City, ...
s.k.Soni's user avatar
  • 1,200
1 vote
2 answers
65 views

Number of Unique Ice Cream Flavors Each Year

Here is a table with different ice cream flavors in different years (name: ice_cream_table): Year Flavor 2008 Mint 2008 Mint 2008 Cookie Dough 2008 Cookie Dough 2008 Pistachio ...
Uk rain troll's user avatar
0 votes
1 answer
143 views

I am confused by SQL select from where in group by having

[![enter image description here][1]][1]now say I have a database, where there is a table kits_parts_needed, and I need to figure out what kit I have parts for, there are fields in this table that ...
Collin Short's user avatar
0 votes
1 answer
55 views

SQL NVL alternative in WHERE clause

I do have that silly job at work,in which I need to analyse and improve the performance on some stupid 20 years old SQL statements. One statement uses NVL in the WHERE clause (no wonder why it's slow) ...
s53818's user avatar
  • 1
0 votes
2 answers
49 views

Is there a way to combine these two MySQL queries into a single statement?

I'm trying to do some dynamic variable calculations on a select and reference those variables in the where statement. After searching the following is as close as I've been able to get thanks to Jonas'...
Joshua Briefman's user avatar
0 votes
0 answers
38 views

Aggregation does not work properly in sql, in a many to many relationship, because of where clause

My setup I have two tables, watch, and tags. They are in a many to many relationship joined by a table called linked_watch_tags. I have a query, where I JOIN these tables, GROUP the query by the watch....
CodeDude's user avatar
-1 votes
1 answer
52 views

Work out in SQL the total money made from increments

I want to work out money made by our automated system say Product Margin Previous Margin Type Purchases Oranges 1 0 Manual 3 Oranges 2 1 Auto 4 Oranges 3 2 Auto 6 Oranges 4 3 Auto 3 Oranges 1 4 ...
james's user avatar
  • 15
0 votes
0 answers
23 views

Using Wildcard in FLWOR

I´m trying to use wildcards in a where clause to recieve elements from an xml file. I´m using BaseX and the built in editor. This line of code: for $route in //route where $route/string(@routeinfo) ...
Markus's user avatar
  • 21
0 votes
0 answers
17 views

No matching signature for operator > for argument types: FLOAT64,

I have the follow syntax select vendornumber, Round(Sum(Freight),2) As Freight From VendorInv Where Dollars > '100' AND Quantity <= '1000' Group By VendorNumber Order By Freight DESC but i'm ...
Ni Mbah's user avatar
0 votes
1 answer
60 views

Exclude rows that contain partial data

I have a field in my dataset that has rows that need to excluded from my output that have the word "invalid" in the field. The data is as follows: 100 - 100 - 100 100 - invalid - 300 200 - ...
DayWalker's user avatar
-4 votes
2 answers
72 views

SQL WHERE clause matching on the same field twice (or more). What is the right JOIN statement to be used? [duplicate]

I have a DB with two tables: employees table: fields = {ID, name} turnShift table: fields = {ID, date, ID_employee1, ID_employee2} Here is an example of this DB. Using MYSQL, I'd like to execute a ...
the_candyman's user avatar
  • 1,607
2 votes
2 answers
111 views

Calculating Age without using a function in the where clause

I have been reading about avoiding using functions in the WHERE clause (as they often have to use scans and are generally not very efficient). I have an SP that calculates a customers age based on ...
Stevie Gray's user avatar
0 votes
1 answer
36 views

Returning a filtered list of items from where the ID is in a list from another array of matching guids

After a bit of help to get the a list filtered using another list of items. Ordinarily I'd of coded around this in SQL, but I need to try to get this working in .NET. I have a list of Roles, and each ...
Gavin Clayton's user avatar
0 votes
2 answers
28 views

Why is SQL query only returning records for a single item in 'WHERE' 'IN' clause?

Why does this query: SELECT dr.facility_id, ds.sys_sample_code, ds.sys_loc_code, ds.matrix_code, ds.sample_type_code, ds.start_depth, ds....
mountainscaler's user avatar
0 votes
1 answer
53 views

How to generalize a "WHERE" clause in a SQL trigger

I'm very new to SQL and practicing creating trigger functions right now. Currently I'm trying to create a stored procedure to update product records when a sale or stock update occurs. Right now, it ...
Finn Kimbrel's user avatar
0 votes
0 answers
19 views

Joining two tables and only listing by specific value in shared field

Trying to use INNER JOIN to combine two table in a class simulation. Once I've listed the fields I need to narrow the return to just items listed as category 3. Tried this SELECT CategoryName, ...
papaspells's user avatar

1
2 3 4 5
183