Questions tagged [clause]
252 questions
0
votes
1 answer
Including IF in a where clause
I need to include an IF or a CASE statement in a where clause that will give me a record dependant on the data in the db.
what I want to do is select a certain contact that has a certain code in relationship_code_id to indicate they have been…

dgoodwin
- 21
- 1
- 4
0
votes
2 answers
Need to put a query in a loop to return result set one by one
I have SQLite DB query which returns me one record at a time.
This is the query:
rawQuery("SELECT id, category_id, title, text FROM customer WHERE (reads = (SELECT MIN(minReads) FROM categories)) AND status = 'a' ORDER BY rating DESC, rand_index…

MySQL DBA
- 5,692
- 21
- 54
- 71
0
votes
1 answer
Use MySQL IN condition in FIND_IN_SET
I have a query where I use a pretty intensive WHERE IN clause to get a list of ID's related to players.
SELECT p.name,
0a.stat_value
FROM leaderheadsplayers p
LEFT JOIN leaderheadsplayersdata_alltime 0a
ON 0a.player_id = p.player_id
AND…

Robin De Baets
- 389
- 1
- 3
- 12
0
votes
1 answer
#1054 - Unknown column 'Klanten.Klantnummer' in 'on clause'
I know that I have seen a couple of other questions about this error but I'm new to the sql JOIN so plz could you guy explain what I'm doing wrong.
Here's my query
SELECT Klanten.Klantnummer,`Barcode`, `Naam`, `BetaalStatus`, `ScanStatus`,…

Alex de Wilde
- 5
- 2
0
votes
2 answers
Java: User provides the where-clause: how to prevent SQL injection?
We are currently developing a feature, a part of which is to allow the user to define a where-clause for a simple select statement, so he can restrict the result he wants to get, via GUI.
The table name may differ, but else it's just a "select *…

Igor O.
- 193
- 1
- 6
0
votes
2 answers
Condition in list - Python
I am working in python and I have this list
for i in range(0, len(state1)):
observations = [{'state_transitions': [{'state': state1[i],
'action': action[i],
…

janeloulou
- 17
- 5
0
votes
1 answer
Unknown column 'r.user_id' in 'where clause'
I managed to patch together this frankenstein query but I'm getting the error Unknown column 'r.user_id' in 'where clause'
Can someone please help me with this? I gave the last portion an alias, but the nested subquery is unable to recognize it. …

Joseph Noirre
- 387
- 4
- 20
0
votes
1 answer
PHP array for an SQL “IN” clause?
i am trying to search multiple roll numbers from database with html form e.g 2345,7654,8976 in a single field
now for php i am trying
$query = "SELECT `firstname`, `lastname`, `roll`, `board`, `city` FROM `result` WHERE…

Malik Ali Jamil
- 11
- 2
0
votes
0 answers
Limit clause in sql injection
Can anyone explain to me why the limit clause in sql injection in some cases returns the first results by typing it like (LIMIT 0,1--) and in some other cases by typing it like (LIMIT 1,1--).
Thanks in advance.

Grigoris Papoutsis
- 57
- 10
0
votes
4 answers
SQL Server dynamic where clause with variables on both sides
Maybe this can't be done (other than with executing a SQL string) and I have tried many different ways but basically I want to build a dynamic where clause with both sides of the conditions as variables.
I need something like (but that works):
WHERE…

user1824596
- 11
- 2
0
votes
1 answer
Parallel summation with openMP - what to do when i can´t use the reduction clause?
I have a function inside a class that i call millions of times in my code.
There are demanding loops in this function that could be parallelized. My problem is that they perform summations that are stored in non-sclar variables.
here is the…

Helton Maciel
- 1
- 1
0
votes
0 answers
Dynamic where clause and operand SQL Server
Having read almost all topics related to dynamic where clauses, I still can't find a way through.
Here is my source table:
Source Table
And the result I want is:
Results
In fact I want to return all values satisfying the Test value condition but…

APL
- 1
- 2
0
votes
2 answers
Hive HQL - optimizing repetitive WINDOW clause
I have following HQL
SELECT count(*) OVER (PARTITION BY identity.hwid, passwordused.domain ORDER BY event.time ROWS BETWEEN CURRENT ROW AND 2 FOLLOWING) pocet,
min(event.time) OVER (PARTITION BY identity.hwid, passwordused.domain ORDER BY…

Vity
- 241
- 3
- 15
0
votes
2 answers
Second return statement nested in if statement
I am wondering what return str.substring(1,4).equals("bad"); is doing here in the else if(len>=4). I think the if statement is a guard clause but I am not 100%. Can I have an explanation of what exactly is going on here? How is this read to output…

M. Nelson
- 29
- 3
0
votes
1 answer
SQL Update across 3 tables - Where clause issue(?)
We need to update various columns on 3 different tables via an input form. most of this is functional however when we try to update the other 2 tables that have been joined (publisher and category), it updates that record and every other record with…

spesh
- 1
- 3