INSERT INTO product_option
(
product_option_id,
product_id,
option_id,
option_value,
required
)
SELECT null, 1171, po.option_id, po.option_value, po.required FROM `product` as p
left outer join product_option as po
on p.product_id = po.product_id
WHERE p.product_id = 1170
group by po.option_id;
SELECT * FROM conversation
INNER JOIN conversation_mem ON (conversation_mem.c_id = conversation.id)
WHERE conversation_mem.user = $my_id
ORDER BY conversation_mem.time DESC
SELECT user_profile.* FROM conversation
INNER JOIN conversation_mem m1 ON (m1.c_id = conversation.id)
INNER JOIN conversation_mem m2 ON (m2.c_id = conversation.id)
INNER JOIN user_profile ON (m2.user = user_profile.id)
WHERE m1.user = $my_id
ORDER BY conversation_mem.time DESC
SELECT user_profile.* FROM conversation_mem m1
INNER JOIN conversation_mem m2 ON (m1.c_id = m2.c_id)
INNER JOIN user_profile ON (m2.user = user_profile.id)
WHERE m1.user = $my_id
ORDER BY conversation_mem.time DESC
WHERE ... AND m2.user <> $my_id