Hi Folks,
The query below select the nearest date to today checking 2 tables according to the criteria. (Actually these tables refers to contact that my costumer have received by phone n95 and email)
"SELECT TOP 1 Time, Date, Identifier, Data, Type FROM (SELECT Logn95.Time, Logn95.Date, Logn95.Number AS Identifier, Logn95.Direction AS Data, 'Call' AS Type From Logn95 WHERE Logn95.Number = '" & cel & "' AND Logn95.Direction = 'Incoming' UNION SELECT Emails_Senderaddress.Time,
Emails_Senderaddress.Date,
Emails_Senderaddress.De_em
ail AS Identifier, Emails_Senderaddress.Subje
ct AS Data, 'Email' AS Type From Emails_Senderaddress WHERE Emails_Senderaddress.De_em
ail = '" & e1 & "' or Emails_Senderaddress.De_em
ail = '" & e2 & "' ORDER BY Date DESC, Time DESC)"
What I would like to create is a query that according to the same criteria above brings all the dates that my costumer was contaccted(acordding with Logn95.Number = '" & cel & " and Emails_Senderaddress.De_em
ail = '" & e1 & "' or Emails_Senderaddress.De_em
ail = '" & e2 & ") and the difference (in days) that he was contacted.
So the outcome in a listbox have to be:
Date Difference(in days) Type
22/07/2008 0 Call
25/07/2008 3 Cell
28/07/2008 3 Cell
Please can you help me with that?
Start Free Trial