Can someone help me out with a simple SQL query?

[font=tahoma,geneva,sans-serif]Hi, I need to email all of our users with a usergroup_id of “8” i can see our customers in the db and their user_id, likewise, I can see all of my relevant customers in[/font] cscart_usergroup_links.

[size=4]How do I run a query that gets the email address of each of those users? THe closest I've gotten is sorting a table of user_ids that match the usergroup_id '8'[/size] Not sure how to match that to email addresses with a query.

Thanks in advance,


Hi Scott,

Please try:

SELECT b.user_id, FROM `cscart_usergroup_links` a
JOIN `cscart_users` b ON a.`user_id` = b.`user_id`
WHERE a.`usergroup_id` = 8 AND a.`status` = 'A'

cs-cart query:
$customers = db_get_array('SELECT b.user_id, FROM ?:usergroup_links a
JOIN ?:users b ON a.user_id = b.user_id
WHERE a.usergroup_id = ?i AND a.`status` = ?s', 8, 'A');


[color=#808080][size=2]part of[/size][/color]

Hi Valentin, how are you my friend? Nice to make contact with you again. Thanks for posting this query! I will give it a try.