Theres already a post here about deleting rows from some table using results from a different query. This is basically the same but more raw/basic. So i have: – a table ‘events’ with id_event,title, etc. – a table ‘users’ with id_user, name, etc. – a table ‘rel_users_events’, which is a relationship between ‘users’ and ‘events’,… Read More »
ok, so i made this nice query to..well, query two tables to check for missing ids on one of them (but it could be mostly anything else). Then i wanted to delete all the ids that dont have a match. This is kind of easily done by deleting the results from a query, but… Read More »
Following the update with data from another table, i am leaving this for quick reference. To insert data into table2 from table2: insert into table2 (field1,field2,field3) select table1.field1,table1.field2,table1.field3 from table1 (all the above is on the same line) We can make this as complex as needed.
Its simple but i thought of leaving it here if i forget (which is usually the case) how to do it again. If you want to insert the records from tableA into tableB, you do something like this: INSERT INTO tableA SELECT * FROM tableB You have to make sure all fields are the same… Read More »