Hi,

I have one doubt in mysql command using limit. I want to delete a first record in a table using mysql query. I using the below query

DELETE from view_me where member_id = '$sess' LIMIT 0,1

But if I used the above query mysql cannot deleted the record. It can deleted only if using the query like below.
DELETE from view_me where member_id = '$sess' LIMIT 1

My doubt why mysql can't delete the record if using the first query. Usually the limit offset is 0 for first record. Then ?

Thanks for all,
Please reply me if anybody have answer for this

Because specifying an offset isn't available with a DELETE query as it is with a SELECT query. You can see the correct syntax for the DELETE query here:

http://dev.mysql.com/doc/refman/5.0/en/delete.html

Hi cscgal,

Thanks for your great reply. I have understood that we can't use offset in delete query. Thanks once again...

Regards,
Mahe4us

You're welcome.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.