Results 1 to 4 of 4
  1. #1
    robinCris is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2017
    Posts
    3

    join with count


    I got a query: select id, phone, email, fType, user, date, area, formName, unit, eName from (SELECT Send.identity as id, Send.phone, Send.email, Send.form_type as fType, Send.user, Send.date, Ezer.area, Ezer.formName, UserName.unit, UserName.eName FROM (Send LEFT JOIN Ezer ON Send.form_type = Ezer.form_type) LEFT JOIN UserName ON Send.user = UserName.user);
    Got another table ("Receive") with the columns date, idintity, and formType
    I need to get the first query but with another flag column. I need to check if in the receive table there is a row with the same identity and form_type with date between the sent date and dateAdd('m', 1, send.date)
    I am going in circle and can't find the answer
    Please advice

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Create a new query, join in the first query with receive table, join on identity and form_type, have as the criteria for the date : Between SentDate And DateAdd('m',1,SentDate)

  3. #3
    robinCris is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2017
    Posts
    3

    Send.date is not recognize

    Quote Originally Posted by aytee111 View Post
    Create a new query, join in the first query with receive table, join on identity and form_type, have as the criteria for the date : Between SentDate And DateAdd('m',1,SentDate)
    but when I do something like this....

    SELECT distinct sendInfo.identity, sendInfo.Date, sendInfo.unit, sendInfo.User, sendInfo.manager, sendInfo.eName, sendInfo.phone, sendInfo.email, sendInfo.form_type, sendInfo.area, sendInfo.formName, qryReceive.form_type as qqq
    FROM (SELECT Send.date, Send.identity, UserName.unit, UserName.User, UserName.manager, UserName.eName, Send.phone, Send.email, Send.form_type, Ezer.area, Ezer.formName
    FROM Ezer RIGHT JOIN (UserName RIGHT JOIN Send ON UserName.user = Send.user) ON Ezer.form_type = Send.form_type) AS sendInfo LEFT JOIN
    (SELECT DISTINCT Receive.form_type, Receive.identity, Receive.Date FROM Receive where Send.date=Between Send.dateAnd DateAdd('m',1,Send.date)) as qryReceive
    ON (sendInfo.identity = qryReceive.identity) AND (sendInfo.form_type = qryReceive.form_type);

    The Send.date is not recognize.
    That was exactly my problem

    Please advice

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Get the query working first, the one in your first post, without the receive table.

    Make a second query, join in the receive table.

    Repeat of instructions in post #2.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-19-2013, 01:38 AM
  2. Inner Join works but not Left Join
    By kwooten in forum Queries
    Replies: 1
    Last Post: 12-11-2012, 05:09 PM
  3. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  4. Count with Left Join on four tables
    By SheikhMusa in forum Queries
    Replies: 3
    Last Post: 04-09-2012, 11:15 AM
  5. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums