K
Kay
Hi
I am creating a database for a taxi company. The company has pickups
arranged into 3 categories, Current Pickups, Bookings and Contract
Pickups. I have created a separate table for each type of pickup.
I want to search pickups by entering the DRIVER ID, FROM DATE and TO
DATE parameters. This should search all 3 tables for pickups made by
the driver id entered and between the dates entered.
I have created a union query that asks me to enter the driver id, from
date and to date but it returns all the records from the 3 table and
not the required records according to the parameters entered. Can
someone please help. The code I have enetered is as follows
SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Current Jobs]
UNION
SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Bookings]
UNION SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Contract Jobs]
WHERE [Driver ID] = [Enter Driver ID]
AND
[Date] between [From Date] and [To Date];
I am creating a database for a taxi company. The company has pickups
arranged into 3 categories, Current Pickups, Bookings and Contract
Pickups. I have created a separate table for each type of pickup.
I want to search pickups by entering the DRIVER ID, FROM DATE and TO
DATE parameters. This should search all 3 tables for pickups made by
the driver id entered and between the dates entered.
I have created a union query that asks me to enter the driver id, from
date and to date but it returns all the records from the 3 table and
not the required records according to the parameters entered. Can
someone please help. The code I have enetered is as follows
SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Current Jobs]
UNION
SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Bookings]
UNION SELECT [Date],[Time],[Door
No/Name],[Place],[Street],[area],[Destination Street],[Quote (if
any)],[Driver ID],[Operator ID],[Notes],[Status]
FROM [Contract Jobs]
WHERE [Driver ID] = [Enter Driver ID]
AND
[Date] between [From Date] and [To Date];