Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    10

    Unanswered: query help please

    Hello everybody

    I need to built a query to fetch the emails for which the newsletter2 is not sent and the emails which are not bounced more than 4 times.

    ( I am using mysql 4.1 version which supports subqueries)

    The tables are

    emails
    mail_id----------------------------cat_id
    user1@site1.com------------------1
    user2@site2.com------------------1
    user3@site3.com------------------1
    user4@site4.com------------------1
    user5@site5.com------------------1
    user6@site6.com------------------1
    user7@site7.com------------------1
    user1@site1.com------------------2
    user2@site2.com------------------2
    user3@site3.com------------------2
    user8@site8.com------------------2
    user9@site9.com------------------2


    sent_mails

    emails -------------------------news_id
    user1@site1.com-----------------1
    user2@site2.com-----------------1
    user3@site3.com-----------------1
    user4@site4.com-----------------2
    user8@site8.com-----------------2
    user3@site3.com-----------------3
    user3@site3.com-----------------4
    user3@site3.com-----------------5


    bounced_mails

    mail_id ------------------------limit
    user3@site3.com---------------4

    The query has to retrieve the emails from sent_mails for which the newsletter2 ( news_id is 2) is not sent so far and the emails should not include the ids which are bounced greater than or equal to 4

    The result should be

    user1@site1.com
    user2@site2.com
    user5@site5.com
    user6@site6.com
    user7@site7.com
    user9@site9.com

    user4@site4.com
    user8@site8.com
    should not be included since it is already received newsletter2.

    Eventhough the email user3@site3.com did not receive the newsletter2 since it is bounced 4 times even that should be excluded from the result.

    Can anybody help to resolve the problem?
    Thanks in advance

  2. #2
    Join Date
    Jul 2003
    Posts
    10
    I resolved the problem. Thanks for everyone who tried to solve this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •