Deletes the first 100 data, sorted by primary key ID.

Source: Internet
Author: User
How do you write SQL statements?
Delete from Visitrecord where ID in (select top of Visitrecord ORDER by ID ASC)

Is there any mistake in writing this?


Reply to discussion (solution)

Delete from Visitrecord where ID in (select ID from Visitrecord ORDER by ID ASC limit 100)

Delete from Visitrecord limit 100

Delete from Visitrecord where ID in (select ID from Visitrecord ORDER by ID ASC limit 100)

This version of MySQL doesn ' t yet support ' LIMIT & in/all/any/some subquery

Delete from Visitrecord where ID in (select top of Visitrecord ORDER by ID ASC)
This is the SQL Server you're writing.

MYSQ the following wording
Delete from Visitrecord where ID in (the Select ID from Visitrecord the ORDER by ID ASC limit 100);

It's all great gods, I'm passing by.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.