Linked Questions
44 questions linked to/from Can you use an alias in the WHERE clause in mysql?
0 votes
1 answer
501 views
MySQL Query cannot find column [duplicate]
I have a query that runs fine, when I try to add one more column to where clouses it cannot find the column and gives an error. SELECT '1' AS `row_count`, ( SELECT COUNT(*) FROM ...
0 votes
1 answer
80 views
Mysql use between, Unix Time Stamp [duplicate]
So i am trying to use Between Timestamp as follows , i have date stored as Unix time stamp and i am 1st trying to convert it, and then get all users between the said time. SELECT users.*, ...
-1 votes
1 answer
77 views
MYSQL syntax - how to use where query with conditional statement in query [duplicate]
This is what i'm trying to query for example: Code Example: SELECT IF(MAIN.PROCESS = 0,"YES","NO") AS `SUCCESS_LOG`, FROM `XLSX_UPLOAD` AS MAIN WHERE `SUCCESS_LOG` LIKE 'NO' ...
-4 votes
1 answer
92 views
How to find out why a SQL query does not produce rows as expected? [duplicate]
I am very new to programming. In my database class, I have to "return only invoices that have a balance due that's greater than 50". When I run this, nothing shows up. What am I doing wrong? USE ap; ...
0 votes
1 answer
53 views
JOIN with WHERE from JOIN [duplicate]
I have multiple tables with data on some clients. What I want to achieve is to output the amount that a certain client was billed for, in the first month he was billed. So I run the code similar to ...
0 votes
1 answer
40 views
How to filter rows with orders of special product? [duplicate]
There is customer table: ---+-------+------------+ id + name + region + ---+-------+------------+ There is also orders table: ---+--------------+------------+----------+----------------+ id +...
0 votes
0 answers
16 views
query on self defined variable [duplicate]
How do I query on a self-defined variable? Example: SELECT *, MID(dateandtime, 12, 2) as 'xxx' FROM xyz WHERE year = '18-19' AND xxx > 18 Is there a way to use xxx in the query like in the last ...
2 votes
3 answers
12k views
MYSQL - Sort by first letter
i have this sql query (below) and it works great but i need to modify it to select only records with $a first character. I've tried a few variations of the LIKE A% with no luck. The crux of my ...
3 votes
3 answers
19k views
mysql CONCAT () AS name?
I'm trying to create little search engine for only a small database. "CONCAT () AS name" does not work so how can I use something like Concat() as xxx ? Created an example here http://sqlfiddle.com/#!...
3 votes
2 answers
6k views
Select AS not working in interbase
works select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW, (bankcleared - checkdate) as DateDiff from Master where (bankcleared is not null) order by payeeid, DOW, DateDiff adding ...
2 votes
2 answers
10k views
MySQL Query to get age from date of birth
I have an issue with my query, SELECT id, pseudo, nom, prenom, sexe, ville, FLOOR(DATEDIFF (NOW(), date_naissance)/365) AS mAge FROM user WHERE sexe = 'Homme' AND mAge BETWEEN 18 AND 25 OR ...
0 votes
2 answers
11k views
MySQL query within if condition
I have the following tables: USERS: id,username,owner ADMINS id,username,owner TRANSACTIONS: id,sender_id,sender_type Each user can be owned by an admin Each admin can be owned by another ...
3 votes
1 answer
4k views
Laravel, MySQL Spatial Point distance: orderBy and get distance
Can anyone help me get this query right. I have a Concert model and another Location model. Concert belongs to a location. Location table has a spatial point field. I need to do three things: order ...
3 votes
3 answers
3k views
Error in query (1054): Unknown column 'TableValue' in 'where clause'
Following up with SELECTing the contents of the Table, which is a result of another value, I wanna keep a condition here on the generated field. If I execute this query: SELECT *, ( SELECT `...
1 vote
3 answers
2k views
Mysql Where Alias equals
given a table 'my_table' with columns col1,col2. Is it possible to write a query like this SELECT col1 as my_alias,col2 FROM my_table WHERE my_alias = 'value' I have tried it but get an unknown ...