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.

9069 questions
13
votes
4 answers

Correct SQLite syntax - UPDATE SELECT with WHERE EXISTS

I am trying to update a selected values in a column in a SQLite table. I only want update of the cells in the maintable where the criteria are met, and the cells must be updated to individual values, taken from a subtable. I have tried the following…
AndBB
  • 157
  • 1
  • 1
  • 6
12
votes
6 answers

Conversion to datetime fails only on WHERE clause?

I'm having a problem with some SQL server queries. Turns out that I have a table with "Attibute_Name" and "Attibute_Value" fields, which can be of any type, stored in varchar. (Yeah... I know.) All the dates for a particular attribute seem to be…
Alpha
  • 7,586
  • 8
  • 59
  • 92
12
votes
2 answers

Difference between `where` keyword inside or outside the curly braces

What is the difference between function foo(a::Adjoint{Float64, Matrix{T}} where T) return 0 end and function foo(a::Adjoint{Float64, Matrix{T} where T}) return 1 end (Note the location of the curly braces.) julia> methods(foo) # 2 methods…
miha priimek
  • 919
  • 6
  • 20
12
votes
2 answers

"where in" MySQL query in nodejs

I need to make MySQL query using "WHERE IN". This is my query: var myQuery = 'SELECT uid FROM ' +tableName+ ' where Gender IN (' + Info.Gender.join() + ')'; If i print Info.Gender it will be ['Male', 'Female'], as a string. but when the query is…
Dan The Man
  • 1,835
  • 6
  • 30
  • 50
12
votes
3 answers

how to add WHERE clause to Query on android

I would like to limit the results to those whose KEY_HOMEID is equal to journalId. I've been on this for a couple days any help would be appreciated. public Cursor fetchAllNotes(String journalId) { return mDb.query(DATABASE_TABLE, new…
Brian
  • 609
  • 3
  • 8
  • 20
12
votes
4 answers

Laravel Eloquent orWhere Query

Can someone show me how to write this query in Eloquent? SELECT * FROM `projects` WHERE `id`='17' OR `id`='19' I am thinking Project::where('id','=','17') ->orWhere('id','=','19') ->get(); Also my variables (17 and 19) in this case…
sarovarc
  • 399
  • 1
  • 5
  • 12
12
votes
2 answers

Extract year from date within WHERE clause

I need to include EXTRACT() function within WHERE clause as follow: SELECT * FROM my_table WHERE EXTRACT(YEAR FROM date) = '2014'; I get a message like this: pg_catalog.date_part(unknown, text) doesn't exist** SQL State 42883 Here is my_table…
wiltomap
  • 3,933
  • 8
  • 37
  • 54
12
votes
3 answers

MySQL group_concat with where clause

I got this problem with Group_Concat and a where filter. In my table i got module names which are linked to a client. I want to search clients by module name, but in the group concat i still want to see all modules that are owned by the client.…
telefoontoestel
  • 357
  • 1
  • 2
  • 14
12
votes
6 answers

fast python numpy where functionality?

I am using numpy's where function many times inside several for loops, but it becomes way too slow. Are there any ways to perform this functionality faster? I read you should try to do in-line for loops, as well as make local variables for functions…
weather guy
  • 397
  • 1
  • 3
  • 17
12
votes
3 answers

JPA - Batch/Bulk Update - What is the better approach?

I found that JPA does not support the following Update: Update Person p set p.name = :name_1 where p.id = :id_1, p.name = :name_2 where p.id = :id_2, p.name = :name_3 where p.id = :id_3 …
Kevin Rave
  • 13,876
  • 35
  • 109
  • 173
12
votes
1 answer

Oracle: How to do multiple counts with different where clauses the best way?

I have requirement to count rows with different where clauses from the same table. The following is the required output from me Bu #A #B #C #D #E #F #G #H #J #K #L #M #N GB01 267 284 84 45 35 32 458 801 111 899 892 56 99 NL01 132 …
rojanu
  • 1,592
  • 5
  • 20
  • 34
12
votes
2 answers

Multiple Table Joins with WHERE clause

I'm using Mysql and I'm having a difficult time trying to get the results from a SELECT query. I am having 3 tables. First table sections, second table section members and third table section member status(data in this table is static). select *…
Bhargav
  • 871
  • 1
  • 13
  • 24
12
votes
3 answers

mysql update + ( where + join) syntax

$rs = mysql_query(" SELECT a.id FROM a JOIN b ON b.id=a.id WHERE b.p1=1 AND a.p1=1"); while($r = mysql_fetch_assoc($rs)) $ids[] = $r['id']; $rs = mysql_query(" …
user669677
12
votes
6 answers

Delete inside foreach with linq where

I can see why this is not allowed: foreach (Thing t in myCollection) { if (shouldDelete(t) { myCollection.Delete(t); } } but how about this? foreach (Thing t in myCollection.Where(o=>shouldDelete(o)) { myCollection.Delete(t); } I…
Andy
  • 10,412
  • 13
  • 70
  • 95
11
votes
1 answer

Will Postgres push down a WHERE clause into a VIEW with a Window Function (Aggregate)?

The docs for Pg's Window function say: The rows considered by a window function are those of the "virtual table" produced by the query's FROM clause as filtered by its WHERE, GROUP BY, and HAVING clauses if any. For example, a row removed because…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468