Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
can anyone tell me why I can not run this code in SQL Management studio?
Thanks in advance.
SELECT * FROM TabKontaktJednani
where
TabKontaktJednani.Typ IN (
CASE 'ERP'--(SELECT ALIAS FROM TabCisZam where LoginId = SUSER_NAME())
WHEN 'ERP'
THEN ('HeO','OST')
WHEN 'TO'
THEN ('SW','OST')
END)
The reason you can't run that code is that CASE expressions can only return one scalar value, not a list of values.
Your CASE expression returns a tuple. That is not allowed in SQL. But as MySQL supports a boolean data type, a CASE expression may result in a boolean:
SELECT *
FROM tabkontaktjednani
WHERE
CASE (SELECT alias FROM tabciszam WHERE loginid = suser_name())
WHEN 'ERP' THEN typ IN ('HeO', 'OST')
WHEN 'TO' THEN typ IN ('SW', 'OST')
END;
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
ERROR: syntax error at or near "r"
Query was:
Delete r,ur from un_received_compansation_reason ur join received_compensation_info r on received_compensation_info.compensation_info_id = un_received_compansation_reason.compensation_info_id where compensation_info_id=2
You have specific table aliases, so try writing the query as:
Delete r, ur
from un_received_compansation_reason ur join
received_compensation_info r
on r.compensation_info_id = ur.compensation_info_id
where r.compensation_info_id = 2;
You need to use table aliases in time joining key like below
Delete r,ur from un_received_compansation_reason ur join
received_compensation_info r on
r.compensation_info_id = ur.compensation_info_id
where ur.compensation_info_id=2
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I used Bootstrap datepicker to get date from the user. I stored that value in database.
But when i render this date in html, it showed unexpected value with the date !
I give the screen shot of the result.
Can anyone help me to solve this ?
How have you stored the date in the database?
Make sure you used DATETIME and not VARCHAR
Also how did you get the date from the database?
I would use:
$query = "SELECT DATE_FORMAT(ColumnName, '%Y-%m-%d %H:%i:%s') AS Date FROM Table";
$result = mysqli_query($cxn,$query) or die(mysqli_error());
$date = $result->fetch_object()->Date;
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
I have been trying this query in different formats yet I don't know why I get this weird error.
insert into details ('refno','membershipno','name','dob','year_of_passing_diploma','phone','address','email','mobileno','city','state','pincode','degree','college') values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv#gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
I don't find anything wrong in this query still I am getting the error
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 ''refno','membershipno','name','dob','year_of_passing_diploma','phone','address',' at line 1
Has anyone experienced the same issue?
You cannot use single quotes around your column identifiers. Either use ticks or nothing:
insert into details (refno,membershipno,name,dob,year_of_passing_diploma,phone,address,email,mobileno,city,state,pincode,degree,college) values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv#gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
or
insert into details (`refno`,`membershipno`,`name`,`dob`,`year_of_passing_diploma`,`phone`,`address`,`email`,`mobileno`,`city`,`state`,`pincode`,`degree`,`college`) values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv#gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
Apart from quoting: you have 14 columns and 23 values in your query
Single quotes (') are used to denote string literals. When refering to columns, you should use forward-quotes, or no quotes at all:
insert into details
(refno,membershipno,name,dob,year_of_passing_diploma,phone,address,email,mobileno,city,state,pincode,degree,college)
values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv#gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')