Looking to see if anyone has a more elegant way of doing this.
$u= db_get_fields(' SELECT DISTINCT user_id FROM ?:users.* WHERE timestamp >= ?i AND timestamp <= ?i and status = ?i', $set_time_from, $set_time_to, 'A')
if (!empty($u)) {
foreach ($u as $user) {
foreach ($u as $user) {
$u = db_get_row('
SELECT *
FROM ?:users
LEFT JOIN ?:user_profiles ON ?:users.user_id=?:user_profiles.user_id
LEFT JOIN ?:orders ON ?:users.user_id = ?:orders.user_id
SELECT *
FROM ?:users
LEFT JOIN ?:user_profiles ON ?:users.user_id=?:user_profiles.user_id
LEFT JOIN ?:orders ON ?:users.user_id = ?:orders.user_id
WHERE ?:users.user_id=?i',
$user);
if ($u['status'] == 'A' && $u['order_id'] == null) {
$non_purchased_user_group[$u['user_id']] = $u;
}
}
}
We are hoping to gather the list of all of our customers from x_time till y_time who are active who have not ordered.
just looking for assistance with making this more efficient, as when it runs it does what we want but it bogs down.
Any help is greatly appreciated.