Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have this query and i am trying to create an extra column with the href link inside it, what is wrong i am doing here
SELECT
Id AS ID,
keywords AS keywords,
'Delete' AS 'Delete'
FROM
tblkeywords
error I am getting is:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':' at line 4
you can use concat function:
SELECT
Id AS ID,
keywords AS keywords,
CONCAT('Delete' AS 'Delete'
FROM
tblkeywords
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
SQL beginner here. I have this database: https://github.com/socratica/data/blob/master/earthquake.csv
I'm running a simple Query such as:
SELECT place, DEPTH1 , OCCURED_ON from EARTHQUAKE1;
I execute it, and get the info I need. However, when I add WHERE depth1 = 35; (I edited the depth col just in case it was conflicting with some other clause)
the GUI returns an error. I tried adding ' and using like, also using TRIM but no luck. I also tried retrieving data from another col, but still no good. What is it that I'm doing brutally wrong?
Thanks in advance!
You have a semicolon after your FROM and before your WHERE.
SQL is reading the WHERE as a separate statement and failing.
The ; is a statement terminator.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I started using MySQL recently and I am facing a problem. I created two tables using create table command and inserted value in the table. These two commands were executed successfully. Then I tried using select command. When I try to execute this command it shows
"select" is not valid at this position for this server version, expecting: (, WITH
Here is my command:
select
*
from Employee,
where Gender="M" and NativePlace="Mumbai",
order Hobby by desc;
What is the reason for this?
There are a couple of syntax errors in your query, try this:
select
*
from Employee
where Gender='M' and NativePlace='Mumbai'
order by Hobby desc;
Remove the commas after Employee and "Mumbai" and you should be good.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I don't get it, this line should work perfectly fine, yet it doesn't. For some reason I am unable to understand why? Can anyone see what I'm missing.
$resclients=$mysqli->query("SELECT id,client_name FROM clients WHERE id = IN ($result)");
The correct SQL query in your case is:
SELECT id,client_name FROM clients WHERE id IN ($result)
as the SQL IN syntax is as follows:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);
Try this code:
$resclients=$mysqli->query("SELECT id,client_name FROM clients WHERE id IN ($result)");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I can't seem to get this one working. I have two tables I want to join but one of the columns has a space in a few of the titles. I am trying the following code with out success.
I have not bought in the columns from the join yet because I want to test that I can make the join.
SELECT rcm.activitydatetime, rcm.'lead id', rcm.'new stage'
FROM customername_leads_by_lifecycle_stage_rcm AS rcm
INNER JOIN customername_leads AS leads
ON rcm.'lead id' = leads.ID;
The warning I get is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''lead id', rcm.'new stage' FROM customername_leads_by_lifecycle_stage_rcm AS rcm INNE' at line 1
Any help is always appreciated, thanks!
Use backticks (`) rather than single quotes (') for column names
SELECT rcm.activitydatetime, rcm.`lead id`, rcm.`new stage`
FROM customername_leads_by_lifecycle_stage_rcm AS rcm
INNER JOIN customername_leads AS leads
ON rcm.`lead id` = leads.ID;
You may also consider renaming the columns so they don't have spaces.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
My query:
UDPATE message_recipients SET
recipient_status = 2 WHERE mid = 3 AND
recipient_id = 4
Table fields:
id, mid, recipient_status, recipient_id
Error:
1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server
version for the right syntax to use
near 'UDPATE message_recipients SET
recipient_status = 2 WHERE mid = 3 AND
recipient_i' at line 1
Could someone give me any advice?
You need UPDATE instead of UDPATE. I do this myself at least three times a week :)