A syntactic form in functional languages used to bind a value to a name in a local scope. Similar, but not identical to, let.
Questions tagged [where-clause]
9069 questions
15
votes
7 answers
SQL order of operations
If I run the following SQL query
SELECT *
FROM A
LEFT JOIN B
ON A.foo=B.foo
WHERE A.date = "Yesterday"
Does the WHERE statement get evaluated before or after the JOIN?
If after, what would be a better way to write this statement so that returns…

tinkertime
- 2,972
- 4
- 30
- 45
15
votes
7 answers
Using a SELECT statement within a WHERE clause
SELECT * FROM ScoresTable WHERE Score =
(SELECT MAX(Score) FROM ScoresTable AS st WHERE st.Date = ScoresTable.Date)
Is there a name to describe using a SELECT statement within a WHERE clause? Is this good/bad practice?
Would this be a better…

jofitz
- 459
- 1
- 3
- 12
15
votes
7 answers
WHERE IN clause in Android sqlite?
I can't get WHERE IN clause to work on android SQLite database.
Is there any way to execute a statement like this in android? :
SELECT body FROM table1 WHERE title IN ('title1', 'title2', 'title3')

fediva
- 151
- 1
- 1
- 3
15
votes
4 answers
SQL WHERE clause with binary
I have a SQL Server database table with a varbinary(max) column (i.e. Data VarBinary(max) in a create table command).
Is it possible to do a where clause with some kind of pattern matching within the binary data?
For example, using the C# .NET…

John Thompson
- 161
- 1
- 1
- 3
15
votes
2 answers
Does "where" position in LINQ query matter when joining in-memory?
Situation: Say we are executing a LINQ query that joins two in-memory lists (so no DbSets or SQL-query generation involved) and this query also has a where clause. This where only filters on properties included in the original set (the from part of…

Felix K.
- 14,171
- 9
- 58
- 72
15
votes
5 answers
mysql NULL value in where in CLAUSE
how to deal with NULL value in mysql where in CLAUSE
i try like
SELECT * FROM mytable WHERE field IN(1,2,3,NULL)
it not working
only work like :
SELECT * FROM mytable WHERE field IN(1,2,3) OR field IS NULL
how can i get it work in WHERE IN ? it…

Haim Evgi
- 123,187
- 45
- 217
- 223
15
votes
4 answers
Cassandra - WHERE clause with non primary key disadvantages
I am new to cassandra and I am using it for analytics tasks (good indexing needed ).
I read in this post (and others): cassandra, select via a non primary key that I can't query my DB with a non-primary key columns with WHERE clause.
To do so, it…

farhawa
- 10,120
- 16
- 49
- 91
15
votes
4 answers
Why doesn't LEFT JOIN return NULL records when used with WHERE clause?
Today I've tried some more complex MySQL queries and I've noticed that MySQL's LEFT JOIN is not working with WHERE clause. I mean, it does return some records but it does not return the ones which are empty on the right side.
For example let's say…

nass
- 382
- 1
- 6
- 19
15
votes
3 answers
LIKE and NULL in WHERE clause in SQL
I have a store procedure which i have planned to use for search and get all values.
Scenario:
If the parameter passed is NULL it should return all the values of the table and if the parameter passed is not NULL it should return the values according…

A Coder
- 3,039
- 7
- 58
- 129
15
votes
2 answers
MySQL - Where Or?
I have a MySQL statement where I'm trying to exclude statements depending on where they "belong to" The query goes through, but it still shows the rows that I specifically said where its not equal to?
SELECT id, belongsto, title, madeby, sticky,…

Necro.
- 987
- 6
- 17
- 29
15
votes
4 answers
How to use If Statement in Where Clause in SQL?
I need to use if statement inside where clause in sql.
Select * from Customer
WHERE (I.IsClose=@ISClose OR @ISClose is NULL)
AND
(C.FirstName like '%'+@ClientName+'%' or @ClientName is NULL )
AND
if (@Value=2)
begin
…

Asp_Newbie
- 269
- 2
- 9
- 17
14
votes
5 answers
Haskell: where clause referencing bound variables in lambda
I am trying to numerically integrate a function in Haskell using the trapezoidal rule, returning an anti-derivative which takes arguments a, b, for the endpoints of the interval to be integrated.
integrate :: (Float -> Float) -> (Float -> Float ->…

Bylextor
- 213
- 3
- 7
14
votes
2 answers
type declarations in 'where' -- what's going on?
While reading the QuickCheck Manual, I came across the following example:
prop_RevRev xs = reverse (reverse xs) == xs
where types = xs::[Int]
The manual goes on to say:
Properties must have monomorphic types. `Polymorphic' properties, such as…

Matt Fenwick
- 48,199
- 22
- 128
- 192
14
votes
4 answers
SQL: How can I update a value on a column only if that value is null?
I have an SQL question which may be basic to some but is confusing me.
Here is an example of column names for a table 'Person':
PersonalID, FirstName, LastName, Car, HairColour, FavDrink, FavFood
Let's say that I input the row:
121312, Rayna,…

Tamara JQ
- 359
- 2
- 7
- 14
14
votes
1 answer
Hibernate @Where is not enforcing at @MappedSuperClass Entity
For migrating from eclipse link to hibernate, I am looking for the equivalent of eclipse link annotation @AdditionalCriteria in Hibernate at @MappedSupperClass BaseEntity level, to filter logically deleted records from all entities extending this…

Bikram
- 828
- 8
- 21