query is wrong? [duplicate] - mysql

This question already has answers here:
#1054 - Unknown column - SQL Query Problem [duplicate]
(2 answers)
Closed 8 years ago.
SELECT *
FROM functions
WHERE isEnabled=1 AND isPrivate=0
AND user_name=high
AND function_description LIKE '%test%'
#1054 - Unknown column 'isEnabled' in 'where clause'

Try putting backticks around your isEnabled field name :
WHERE `isEnabled`=1
The isEnable field have the E Capital letter ...

Related

unknown column in ' WHERE CLAUSE' [duplicate]

This question already has answers here:
Hyphens in column names in MySQL DB
(6 answers)
Closed 3 years ago.
I have simple sql query
it should fetch the result but showing following error:
Error Code: 1054. Unknown column 'marital' in 'where clause' 0.000 sec
The column is present in the table
SELECT * FROM usa.adult
WHERE marital-status='Never-married'
AND gender='Male'
Thanks
I believe your column name is wrong, perhaps, it is marital_status? (use an underscore instead of a hyphen.
you can use [marital-status] or 'marital-status', if the column name is infact correct.
Please check your table schema and find the correct column name.
The query should like this
SELECT * FROM usa.adult
WHERE `marital-status`='Never-married'
AND gender='Male';
You should use marital_status rather than Marital-status. Use underscore because hyphen is not allowed.

Limit (Cut-off) number returned by function 'count(*)' in MySQL [duplicate]

This question already has answers here:
Unknown Column In Where Clause
(16 answers)
Closed 5 years ago.
When I try this in MySQL:
select make,count(*) as num from TABLE where num > 100 group by
make
I got:
Error Code: 1054, SQL State: 42S22] Unknown column 'num' in 'where clause'
Is there a way to limit count(*)?
You can't put column aliasas in the WHERE clause. Use a derived table instead:
select make, num
from
(
select make,count(*) as num from TABLE group by make
) dt
where num > 100

MySQLSyntaxErrorException: Unknown column 'John' in 'where clause' [duplicate]

This question already has answers here:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Smith' in 'where clause'
(2 answers)
Closed 7 months ago.
I'm trying to retrieve records base on the keyword which is stored into skw textbox, when I pass USN or Age then it gives correct result but it's not working with Name. It throwing error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExceptionUnknown
column 'NAME_KEYWORD(skw)' in 'where clause'
ResultSet res=stmt.executeQuery("select * from Student where USN="+skw.getText()+" or Name='"+skw.getText()+"' or Age="+skw.getText()+"");
If you are select for text you should wrap with single quote the text values
ResultSet res=stmt.executeQuery("select * from Student where USN='"
+skw.getText()+"' or Name='"+skw.getText()+"' or Age='"+skw.getText()+"'");
otherwise the resulting text in used as column name

Mysql Select Where IN Unknown column [duplicate]

This question already has answers here:
When to use single quotes, double quotes, and backticks in MySQL
(13 answers)
Closed 6 years ago.
I'm having some problem with mysql code in phpmyadmin. I want to run this code:
SELECT *
FROM table
WHERE ID
IN (
38b5f138683c57ccb1d5beec62284d8f, 08dcd7bf2fb5dc6d73d114c84c252393, bda3a36a9392a91f9142e0442e24bf24, 38963779bc562e388cbf702d6f0189cc, 98989c3c20be63f856d48a3f0584b85e
)
but I received this error: #1054 - Unknown column '38b5f138683c57ccb1d5beec62284d8f' in 'where clause'
Can anyone point me in the right direction as to the possible causes of this error?
try
SELECT * FROM table WHERE ID IN ( "38b5f138683c57ccb1d5beec62284d8f", "08dcd7bf2fb5dc6d73d114c84c252393", "bda3a36a9392a91f9142e0442e24bf24", "38963779bc562e388cbf702d6f0189cc", "98989c3c20be63f856d48a3f0584b85e" )

Unknown column in where clause. Why? [duplicate]

This question already has answers here:
Unknown Column In Where Clause
(16 answers)
Closed 8 years ago.
I use next query:
SELECT ROUND(r/h) AS conv FROM table WHERE conv > 1
I receive error "Unknown column 'conv' in 'where clause'", But why? After AS conv is it not exists yet?
The column alias isn't available until results are being produced. Try
SELECT ROUND(R / H) AS CONV
FROM TABLE1
WHERE ROUND(R / H) > 1
SQLFiddle here.
Share and enjoy.