Created
November 24, 2009 16:12
-
-
Save jimmybaker/241975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select u.id, u.first_name, u.last_name, u.email, | |
(select so.shipto_postal_code from sales_orders so where so.user_id = u.id and so.state != 'pending' order by so.placed_at desc limit 1) | |
from users u | |
where | |
u.contact_me = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment