Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

php - Check the documentation for the version of MariaDB you are using for the correct syntax around 'DESC LIMIT 1) LIMIT 0, 50' on line 1

SELECT summary FROM cms_module_cgblog WHERE cgblog_id=(SELECT article_id FROM cms_module_cgblog_tags_link WHERE tag_id=979 DESC LIMIT 1);

Why is this request incorrect?

MySQL answer: Documentation

1064 - You have an error in your request. Check the documentation for the version of MariaDB you are using for the correct syntax around 'DESC LIMIT 1) LIMIT 0, 50' on line 1

question from:https://stackoverflow.com/questions/65931237/check-the-documentation-for-the-version-of-mariadb-you-are-using-for-the-correct

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For sorting in descending order you need to use: ORDER BY keyword

Your query should be like this -

SELECT summary FROM cms_module_cgblog WHERE cgblog_id=(SELECT article_id FROM cms_module_cgblog_tags_link WHERE tag_id=979 ORDER BY tag_id DESC LIMIT 1);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...