Questions tagged [clause]
252 questions
0
votes
1 answer
MySQL - Custom error in WHERE clause
I'm developing a PHP script with MySQL database connection. The problem I'm having is my queries have to be optimized because I handle a lot of information and, in order to do so, I'm making large queries.
To write an example I won't write a large…

Unapedra
- 2,043
- 4
- 25
- 42
0
votes
2 answers
Maybe TIMEDIFF function in sql is not accepting column name as one of the parameters
My requirement is to pull records from mysql database which have just 5 mins left from the current time as per the one of the columns in the database. The column is has user inserted datetime.
date_default_timezone_set("UTC");
$utc_time =…

user2575238
- 1
- 1
0
votes
3 answers
not using index in where clause
If i have the following in the where clause :
( approps_precio * moneda_valor BETWEEN 2000 AND 6000)
it does not use the idx_approps_precio index.
But
( approps_precio BETWEEN 2000 AND 6000)
does it very well.
Is there a way to add the * operation…

KillDash9
- 879
- 1
- 8
- 21
0
votes
6 answers
weird behaviour in python if clause
I wrote a simple little rock, paper, scissors game in python and had some difficulties with an if clause, here's the relevant code:
def play():
user = str(input("rock, paper or scissors? Choose one: "))
print("You chose", user)
if user…

Peter Goldsborough
- 1,366
- 16
- 20
0
votes
1 answer
Crystal Reports Formula - How to add another clause
I have this :
IIF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} = 'Daywork',
{REPORT_INVOICE_SUMMARY.QUANTITY},
0)
What is this doing? and how can i add another check for say a Nightwork item? would it be like this?
IIF…

jordan
- 3,436
- 11
- 44
- 75
0
votes
4 answers
Oracle date function
I am executing the below query,It returns me the blank row.However there are records in the table having upd_time = '12-MAR-08'.I don't understand why it is not returning the date '12-MAR-08'.Please help me out??
SELECT br_data.upd_time FROM…
kunj
0
votes
2 answers
Reference something in the select clause SQL
I was wondering if you can reference something in the where clause like:
select
sum([some calculation]) as x,
sum([some other calculation]) as y,
x/y as z
from
[rest of the sql...]
Many Thanks
K

K_McCormic
- 334
- 2
- 5
- 17
0
votes
2 answers
How to find all onDelete clauses with 'Restrict' value from a database?
I need to find and fix all the onDelete clauses of foreign keys, on a MySQL database, because all of them are now by default RESTRICT.
Can this be done by a MySQL-query?
At least to find all the foreign keys
UPDATE after @peterm answer:
SELECT *…

user1236048
- 5,542
- 7
- 50
- 87
0
votes
2 answers
MySQL AND statement fails
I have a query that fails It seems to be the AND statement that is failing.
if(isset($_POST['sea']) && $_POST['sm'] !==''){
$sm = trim($_POST['sm']);
$sql = "SELECT * FROM `memorials` WHERE `fname` LIKE '$sm%' OR `lname` LIKE '$sm%' OR `comments`…

Gary
- 33
- 4
0
votes
2 answers
Getting unique rows from column sqlite android cursor
Hi I cant get unique rows tried this from the documentation:
public Cursor getcepaUnico(){
return database.query(true, "vino", new String[] {"_id", "cepa"}, null, null, null, null, "cepa", null);}
but shows duplicated rows even if the DISTINCT…

Marco Moderatto
- 59
- 1
- 1
- 8
0
votes
1 answer
T-SQL - Return list of values to IN clause depending on another list of values
The gist is, I want to return a list of employee_id numbers for the IN clause.
I am given a list of employee_ids like (2,3,4,5) and a company_id like 5. Some of these belong to company=5, some do not. If any of these belong to company=5, then I want…

nexguy
- 3
- 2
0
votes
1 answer
HSQL trigger with multiple when clause
Can we create Trigger in HSQL DB, with multiple WHEN clause. Something like this :-
CREATE TRIGGER perosn_trig AFTER UPDATE ON person
REFERENCING NEW AS nwrow OLD as oldrow
FOR EACH ROW
when ( nwrow.person_id>100 )
( insert into TRIGLOG…

Kaushik Lele
- 6,439
- 13
- 50
- 76
0
votes
1 answer
Mysql returning rows with zero (0) column data in WHERE clause
I have a simple query for my table:
SELECT * from delivery_receipts WHERE siid='';
This table's unique key is drid, (irrelevant for this question)..
The targeted column (siid) is an int(11) field, non index and non unique...
Anyway my problem is…

BrownChiLD
- 3,545
- 9
- 43
- 61
0
votes
1 answer
Can any one simplify the where condition of this mysql select
Hi. Can any one simplify the where condition of this mysql select statement? It takes a long time to bring the result or it asks for SET SQL_BIG_SELECTS=1.
In the query below:
The postcode contains values like BH12 or SW10,
The *req_area* contains…

JIS
- 1
- 3
0
votes
1 answer
"group by is used to organize the data before other clauses - such as where, order by and functions...",really? Ref: Learning MySQLupdate
"group by is used to organize the data before other clauses - such as where, order by and functions -are applied. In contrast, order by is applied last- after the query has been resolved -to reorganize the query output for display.",really? Ref:…

Sandy
- 313
- 1
- 4
- 13