-2

I have some columns in "user" table like name , email , country, last_online ,as example :

> Mohamed , email , UAE , 2014-06-24 21:43:16
> 
> Ali , email , LY , 2013-05-18 07:13:56
> 
> Zeyad , email , EG , 2011-04-12 19:52:23

i want delete users data whom never logged since 2011-01-01 ,How can i do it ?

7
  • What exactly seems to be a problem? Commented Jun 24, 2014 at 19:57
  • Study up. dev.mysql.com/doc/refman/5.0/en/delete.html Commented Jun 24, 2014 at 19:58
  • 1
    stackoverflow.com/questions/10643379/… may be of help. Once you're happy with your select query, you can change it to a delete: dev.mysql.com/doc/refman/5.0/en/delete.html Commented Jun 24, 2014 at 19:59
  • 1
    delete from user where last_login <= '2011-01-01' Commented Jun 24, 2014 at 19:59
  • 1
    First try select * from user where last_login <= '2011-01-01'. See the results that you're given. Understand why you get the results you do. Then, change the select * to delete and rerun the query. The rows that came up in the select will be the same rows that are deleted. Commented Jun 24, 2014 at 20:12

1 Answer 1

0

A basic delete statement is all that you need:

delete from user where last_online <= '2011-01-01'

You should try to read up on basic SQL syntax.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.