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
9,131
questions
0
votes
1
answer
22
views
How to use element in select in where clause in mysql query
Ive a simple table with four colums:
id
date
prev
cam
1
2024-07-06
98955
41
2
2024-07-05
98955
31
3
2024-07-05
98000
41
4
2024-07-06
100955
41
I have to create a query to show only element prev ...
0
votes
1
answer
43
views
SQL Oracle How to find distinct word but not a word out of context?
I have a table where a column called NOTE has some text. I'm trying to return only the rows that have 'ABC', but not rows that contain 'ABCD', 'ZABC', etc.
I was thinking of something like select * ...
-1
votes
0
answers
48
views
sum multiple columns with many conditions
By adding more conditions to sum many columns it gives an error(incomplete input)
i.e this one works very fine
c.execute("""select sum(mckn), sum(mbrd), sum(mbon), sum(mrol) , sum(mrolm)...
-1
votes
2
answers
40
views
WHERE clause pulling incorrect values
I am calling a table and looking to find null values. Where report_date is looking for TRUE and two other columns are looking for FALSE, I seem to be getting inflated numbers and I believe it is the ...
0
votes
1
answer
37
views
Error when using the copy function in postgresql
I need to use the copy function with innerjoin from more than one table with where.
Postgresql if pgadmin 4
When I do this query, it returns the data I need
select * from estabelecimento join empresa ...
1
vote
1
answer
67
views
Where clause doesn't work with aggregate without group by Clickhouse
I'm trying to count sum and count without group by with three different conditions and add written flag to distinguish them from each other. Then I'm trying to get the only one record with certain ...
1
vote
1
answer
71
views
SQLAlchemy: checking if a filter has been set causes `TypeError: Boolean value of this clause is not defined`
I have set up a method in python that chunks a SQL IN-Query (our DB does not like too big IN-Clauses). The method receives also optionally a filter, and this is where my error comes. When I pass the ...
0
votes
1
answer
41
views
How to filter out orders with zero dollars in sales in SQL?
I'm trying to filter out orders that have $0 in sales but I'm somewhat new to writing SQL code so I'm not exactly sure how I would go about writing this. I'm more familiar with writing DAX, which in ...
0
votes
2
answers
44
views
Filter out codes under certain conditions
I need to filter out codes beginning with 45XXX except code that equals 45003
using a where clause:
Select * from table where code NOT IN ('45%')
will filter out all codes beginning with 45 ...
0
votes
1
answer
29
views
Postgresql, JOIN on the same table with two values?
I need to pull data from various tables based on foreign key id's using both multiple JOINS and multiple WHERE clauses.
At the moment I have this (which is of course not working):
SELECT table_1.*
...
1
vote
1
answer
27
views
How to use the default value set for a table in a where condition in an update statement?
I want to use the default value (string) for a specific column in a specific table in the where condition of an update statement in SQLite. So, the column should only be updated if the current value ...
0
votes
2
answers
39
views
Oracle SQL : different where clauses with respect to the different variables in a single clause
CATEGORY
DATE(DD.MM.YYYY)
a
01.01.2024
a
02.01.2024
a
03.01.2024
a
04.01.2024
a
05.01.2024
b
01.01.2024
b
10.01.2024
b
15.01.2024
c
01.01.2024
c
11.01.2024
c
25.01.2024
I am trying to get ...
0
votes
2
answers
40
views
Usage of 'in' operator in Postgres sql
I have created a CTE using 'with' clause and I am using case when expression to populate a column in CTE and I wanted to use the result of case when expression in where condition as a criteria value ...
0
votes
0
answers
17
views
Differences in Presto SQL between Join via Where clause and Inner Join [duplicate]
I want to understand the differences in Presto SQL (result-wise and performance-wise) between the following 2 queries:
SELECT
table1.field1, table1.field2, table2. field3
FROM
table1
JOIN (or ...
0
votes
2
answers
45
views
Laravel where condition within 'with'
I have an eloquent query:
$cameras=Jump::Video()
->with('flight','flight.aircraft','flight.airfield')
->with('student','student.logininfo','student.logininfo....