Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.7Mb
PDF (A4) - 35.8Mb
PDF (RPM) - 34.8Mb
EPUB - 8.7Mb
HTML Download (TGZ) - 8.5Mb
HTML Download (Zip) - 8.5Mb
HTML Download (RPM) - 7.3Mb
Eclipse Doc Plugin (TGZ) - 9.3Mb
Eclipse Doc Plugin (Zip) - 11.5Mb
Man Pages (TGZ) - 203.7Kb
Man Pages (Zip) - 309.0Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

14.7.4 SET Syntax

The SET statement has several forms:


User Comments
  Posted by George Marshall on June 14, 2014
When using the multiple variable assignment syntax, none of the assignments can depend on the results of the other assignments. For example, the variable @d will not be assigned a value:

set @c=1, @d=@c+1;
select @c, @d; # @d will be null
  Posted by Richard Pecker on May 19, 2016
These are some examples that can help users with syntax issues
SELECT Place, count(*) FROM Testing WHERE SUBSTRING(Place,2,1) IN ('c', 'u','s') GROUP BY Place HAVING count(*)>=2 ORDER BY count(*)asc, Place DESC;

SELECT CONCAT(TESTING.name, ', ', TESTING.section ,', ', location, ', ', code) AS "Employer Info"
FROM TESTING, secondary
WHERE TESTING.companyname = secondary.companyname and
TESTING.section = secondary.section
and array='y'
ORDER BY code ASC, TESTING.companyname DESC, TESTING.section ASC;

SELECT disks FROM store WHERE disks NOT IN (SELECT cds FROM amazon);

SELECT SUBSTR(code, 1, 4) AS Time,
ROUND(MIN(min1)) "Minimum Value"
FROM Testing
GROUP BY Time;

SELECT info, COUNT(places) as 'Amount of places'
FROM testing LEFT JOIN secondTable ON testing.code = secondTable.location WHERE
INSTR(info, 'possible')
GROUP BY info;
Sign Up Login You must be logged in to post a comment.