I don't know if I will be able to describe this very well, I hardly understand it...who am I kidding, I don't understand it.
On the page that I have to make selections from that are used to build the query are. StartDate, EndDate, List of trucks, drop down with sensor names populated from cust_truck_sensors (select distinct sensor_name from cust_truck_sensors)
So the user can search between some date on any number of trucks on only one sensor.
4 Tables
cust_trucks ( oid = matches with cust_positions asset_id, truck_name )
(ex: 2, Truck1)
(ex: 4, Truck2)
cust_positions ( (OID = PK), (date_time = time of the record), (asset_id = truck we are searching on), (asset_type_id = 2), Latitude, Longitude, Location )
cust_truck_sensors ((OID = PK), (cust_truck_id = FK from cust_positions asset_id), sensor_num(a truck can have multiple sensors in it, this field is a number that relates to what sensor it is in the truck), sensor_name (Text name of the sensor, there can be multiple OID's with the same sensor_name(ex:Sensor1, Sensor2,SensorA) )
(ex: 2, 2, 1, Door Open) Truck number 2's first sensor tracks when the door opens
(ex: 5, 4, 2, Ignition) Truck number 4's second sensor tracks when the ignition is triggered.
cust_position_detail( (OID = PK), (position_id = FK from OID in cust_positions), (position_detail_type_id = 1, because 1 is always a sensoc), (detail_value_1 = what sensor from the truck went off)
Every time a sensor is set off, there will be an entry in this table.
(ex: 2, 140, 1, 1) At position_id from cust_positions oid, the sensor number 1 went off
(ex: 3, 143, 1, 2) At position_id from cust_positions oid, the sensor number 2 went off
In the end I want to display
- Truck Name
- Latitude
- Longitude
- Date
- Location
I know that this is all part of my where
WOW...lol
Any Questions??
Thanks
On the page that I have to make selections from that are used to build the query are. StartDate, EndDate, List of trucks, drop down with sensor names populated from cust_truck_sensors (select distinct sensor_name from cust_truck_sensors)
So the user can search between some date on any number of trucks on only one sensor.
4 Tables
cust_trucks ( oid = matches with cust_positions asset_id, truck_name )
(ex: 2, Truck1)
(ex: 4, Truck2)
cust_positions ( (OID = PK), (date_time = time of the record), (asset_id = truck we are searching on), (asset_type_id = 2), Latitude, Longitude, Location )
cust_truck_sensors ((OID = PK), (cust_truck_id = FK from cust_positions asset_id), sensor_num(a truck can have multiple sensors in it, this field is a number that relates to what sensor it is in the truck), sensor_name (Text name of the sensor, there can be multiple OID's with the same sensor_name(ex:Sensor1, Sensor2,SensorA) )
(ex: 2, 2, 1, Door Open) Truck number 2's first sensor tracks when the door opens
(ex: 5, 4, 2, Ignition) Truck number 4's second sensor tracks when the ignition is triggered.
cust_position_detail( (OID = PK), (position_id = FK from OID in cust_positions), (position_detail_type_id = 1, because 1 is always a sensoc), (detail_value_1 = what sensor from the truck went off)
Every time a sensor is set off, there will be an entry in this table.
(ex: 2, 140, 1, 1) At position_id from cust_positions oid, the sensor number 1 went off
(ex: 3, 143, 1, 2) At position_id from cust_positions oid, the sensor number 2 went off
In the end I want to display
- Truck Name
- Latitude
- Longitude
- Date
- Location
I know that this is all part of my where
Code:
FROM
QATech_DataStore."cust_positions" "p",
QATech_DataStore."cust_trucks"
WHERE
QATech_DataStore."cust_trucks"."OID" = "p"."asset_id"
AND
("p"."date_time" between to_date('07/18/2006 12:00AM', 'MM/DD/YYYY HH:MIAM')
and
to_date('07/18/2006 4:30PM', 'MM/DD/YYYY HH:MIAM'))
AND
"p"."asset_type_id" = 2
WOW...lol
Any Questions??
Thanks