Selecting a range of users active in the past month, but not in the past week I have two tables, users and meetings. I'm trying to select all the users who have NOT made a meeting in the past week, but have made a meeting in the past month.

SELECT  u.id, u.given_name, u.family_name, u.email 
    FROM users u 
    JOIN meetings m ON (u.id != m.user_id) 
    AND m.created_at BETWEEN %s and %s 
    AND u.state ='active' 
    AND u.id in (SELECT user_id 
                 from meetings 
               where created_at BETWEEN %s and %s)
    GROUP BY u.id, u.given_name, u.family_name, u.email


This is using the psycopg2 adapter, so %s will be replaced by a datetime object. The %s replacement is in the order of: 

7 days ago, today, a month ago, 8 days ago.

Also, the reason i did u.id != m.useridis because the userid will not be in the meetings table if the user has not organized a meeting in the last week.

This doesn't seem to be working, as I am still getting people who have organized a meeting in the past week.
You can write a CTE[1] to compute a date interval, take a look:

WITH last_month_minus_thisweek AS(
     SELECT GENERATE_SERIES(CURRENT_DATE - '1 Month'::interval, CURRENT_DATE - '1 week'::INTERVAL, '1 day') AS day
), date_list AS (
     SELECT MIN(day) AS start_date, MAX(day) as end_date FROM last_month_minus_thisweek
)

SELECT * FROM date_list;


To use with your query, put date_list on there FROM clause when adjust your filter, eg:

WITH last_month_minus_thisweek AS(
     SELECT GENERATE_SERIES(CURRENT_DATE - '1 Month'::interval, CURRENT_DATE - '1 week'::INTERVAL, '1 day') AS day
), date_list AS (
     SELECT MIN(day) AS start_date, MAX(day) as end_date FROM last_month_minus_thisweek
)

SELECT  u.id, u.given_name, u.family_name, u.email 
FROM users u, last_month_minus_thisweek
JOIN meetings m ON (u.id != m.user_id) 
AND m.created_at BETWEEN %s and %s 
AND u.state ='active' 
AND u.id in (SELECT user_id 
             from meetings 
           where created_at BETWEEN date_list.start_date and date_list.end_date)
GROUP BY u.id, u.given_name, u.family_name, u.email;


I Hope it helps.

[1] https://www.postgresql.org/docs/current/static/queries-with.html