Advertisement

07.22.2008 at 03:30PM PDT, ID: 23586843
[x]
Attachment Details

SQL Query

Asked by mgebste in Microsoft Office Suite, Microsoft Access Database

Tags: Microsoft, Office, Access 2007

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_email AS Identifier, Emails_Senderaddress.Subject AS Data, 'Email' AS Type From Emails_Senderaddress WHERE Emails_Senderaddress.De_email = '" & e1 & "' or Emails_Senderaddress.De_email = '" & 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_email = '" & e1 & "' or Emails_Senderaddress.De_email = '" & 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
[+][-]07.22.2008 at 10:09PM PDT, ID: 22066150

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 05:09AM PDT, ID: 22068217

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:15AM PDT, ID: 22069502

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Office Suite, Microsoft Access Database
Tags: Microsoft, Office, Access 2007
Sign Up Now!
Solution Provided By: fhlio_admin
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628