combining 2 SQL statements

Rixx

Registered User.
Local time
Today, 14:26
Joined
Mar 3, 2005
Messages
25
Hello. I have a problem implementing two separate SQL statements in dreamweaver from an Access 2003 database. The queries work fine in Access but is causing many problems in dreamweaver as they are separated.

I very much so need help in combining these two statements to form one SQL statement. Any help will be greatly appreciated. Thanks again.

SQL Statements


FIRST QUERY

SELECT tblApp.Time
FROM tblApp
WHERE (((tblApp.BranchID)=[Forms]![frmApp]![branch]) AND ((tblApp.Date)=[Forms]![frmApp]![date]));


SECOND QUERY

SELECT tblTime.Time
FROM tblTime LEFT JOIN qryAppointmentsOnDate ON tblTime.Time = qryAppointmentsOnDate.Time
WHERE (((tblTime.Branch)=[Forms]![frmApp]![branch]) AND ((qryAppointmentsOnDate.Time) Is Null));


Rixx
 
Take a look at using a UNION query in Access Help.
 
Hi PDX_Man

thanks for the reply! I've been looking at the Union function and havent been getting anywhere :(

I used this method of connecting the two queries:

SELECT tblApp.Time
FROM tblApp
WHERE (((tblApp.BranchID)=[Forms]![frmApp]![branch]) AND ((tblApp.Date)=[Forms]![frmApp]![date]))
UNION
SELECT tblTime.Time
FROM tblTime LEFT JOIN qryAppointmentsOnDate ON tblTime.Time = qryAppointmentsOnDate.Time
WHERE (((tblTime.Branch)=[Forms]![frmApp]![branch]) AND ((qryAppointmentsOnDate.Time) Is Null));


Unfortunately, it did not produce the results as intended at all! I have been working on this for hours and have really been trying to come to a solution by looking through tutorials and articles on the internet.

I appreciate if anyone can provide anymore of a point in the right direction.

Thanks again

Rixx
 
Unfortunately, it did not produce the results as intended at all!

Could you be a bit more precisely.

RV
 
RV said:
Could you be a bit more precisely.

RV


Yeah, what are your intended results? The UNION query will squish the results of the two queries together removing duplicates. That is what it sounds like you were wanting. If it is OK to have duplicates, then use the UNION ALL.
 

Users who are viewing this thread

Back
Top Bottom