Sample mysql queries

Delete Rows based on output from a query :

DELETE FROM Table1 WHERE EXISTS(SELECT 1 FROM Table2 WHERE Table2.Group = Table1.Group)
or
delete from Table1 where id in (select id from table1 inner join table2 on Table1.group = Table2.group)
or
delete from table 1 where group in (select distinct group from table2)

Delete Data based on Date:

Delete from table where datefield < (DATE_SUB(CURDATE(), INTERVAL 6 MONTH))