Jump to content

MySql copy from one table to another


cip6791

Recommended Posts

Hi all,

 

I have a question. I currently use a classifieds script that deletes the ad after a certain amount of time. So I lose the e-mail which was used to post the ad. I would like to copy the existing email from the ads table to another table and keep them there for future use. Does anybody have any idea how this can be done? I would like it to be automatically copied into the new table.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/120969-mysql-copy-from-one-table-to-another/
Share on other sites

try something like

Insert into `emails` (AdName, Email) Values(Select Name, Email from `ads` where Id = IDHERE))

and then delete

No, not at all... that won't work.

 

I have a question. I currently use a classifieds script that deletes the ad after a certain amount of time. So I lose the e-mail which was used to post the ad.

Why not use a datetime field to mark the record as expired, instead of deleting it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.