Skip to content

Instantly share code, notes, and snippets.

@ErDmKo
Last active December 19, 2015 08:49
Show Gist options
  • Save ErDmKo/5928723 to your computer and use it in GitHub Desktop.
Save ErDmKo/5928723 to your computer and use it in GitHub Desktop.
move my db
insert into orders_useradr
select
NULL as id,
p.user_id as user_id,
p.city as adr
from
orders_userprofile as p;
update
orders_userprofile,
orders_useradr
set
orders_userprofile.adr_id = orders_useradr.id
WHERE
orders_useradr.user_id=orders_userprofile.user_id
select count(*) from (
SELECT count(`orders_order`.id) as no FROM `orders_order`
left join orders_orderurl
on orders_order.id = orders_orderurl.order_id
GROUP BY `orders_order`.id HAVING count(orders_orderurl.url) > 1
) as t
UPDATE from customprofile_userbalancehistory as history
LEFT JOIN customprofile_paylog as log
ON history.user_id = log.user_id
SET history.ts = log.created
WHERE date(ts) < '2013-01-10' AND info like '%0%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment