Untitled
unknown
mysql
a year ago
587 B
11
Indexable
select `user_openai`.*
from `user_openai`
left join
(
SELECT workspaces.id
FROM workspaces
INNER JOIN user_orders ON workspaces.created_by = user_orders.user_id
WHERE user_orders.status = "Success"
AND user_orders.price > 0
AND user_orders.type = "subscription"
) as paying_workspaces on `user_openai`.`workspace_id` = `paying_workspaces`.`id`
where
`paying_workspaces`.`id` is null
and `user_openai`.`root_id` is null
and `user_openai`.`created_at` < ?
order by `user_openai`.`created_at` asc
limit 100 Editor is loading...
Leave a Comment