C
Capt'n
Hi,
I am using Win/xp and MSAccess2000.
I am not very good with sql syntax. But I mave two table with a
relationship of One to Many.
What I want is just one row from the MANY table (Mainetenace). This
qry return all rows from Maintenance table for an Asset.
How can I code this to get just one row from the maintenance table?
thanks,
Capt'n
here is my syntax:
SELECT [Assets].[StatusID], [Assets].[AssetDescription], [Maintenance
Latest Date].[AssetID], [Maintenance Latest Date].[MaintenanceDate],
DateDiff("ww",[maintenancedate],Now()) AS elaspedweeks,
[Assets].[MainAvgUsageHrs], [Assets].[DaysInWorkWeek],
[Assets].[OperatingHours],
Round(([operatinghours]-DateDiff("ww",[maintenancedate],Now())*[daysinworkweek])/[MainAvgUsageHrs])
AS NextMaintDays,
DateAdd("ww",Round([NextMaintDays]/[daysInWorkWeek]),[MaintenanceDate])
AS NextMaintenanceDate, [Assets].[LocationID], [Locations].[Location]
FROM Locations INNER JOIN ([Maintenance Latest Date] INNER JOIN Assets
ON [Maintenance Latest Date].[AssetID]=[Assets].[AssetID]) ON
[Locations].[LocationID]=[Assets].[LocationID]
WHERE ((([Assets].[StatusID])=1));
I am using Win/xp and MSAccess2000.
I am not very good with sql syntax. But I mave two table with a
relationship of One to Many.
What I want is just one row from the MANY table (Mainetenace). This
qry return all rows from Maintenance table for an Asset.
How can I code this to get just one row from the maintenance table?
thanks,
Capt'n
here is my syntax:
SELECT [Assets].[StatusID], [Assets].[AssetDescription], [Maintenance
Latest Date].[AssetID], [Maintenance Latest Date].[MaintenanceDate],
DateDiff("ww",[maintenancedate],Now()) AS elaspedweeks,
[Assets].[MainAvgUsageHrs], [Assets].[DaysInWorkWeek],
[Assets].[OperatingHours],
Round(([operatinghours]-DateDiff("ww",[maintenancedate],Now())*[daysinworkweek])/[MainAvgUsageHrs])
AS NextMaintDays,
DateAdd("ww",Round([NextMaintDays]/[daysInWorkWeek]),[MaintenanceDate])
AS NextMaintenanceDate, [Assets].[LocationID], [Locations].[Location]
FROM Locations INNER JOIN ([Maintenance Latest Date] INNER JOIN Assets
ON [Maintenance Latest Date].[AssetID]=[Assets].[AssetID]) ON
[Locations].[LocationID]=[Assets].[LocationID]
WHERE ((([Assets].[StatusID])=1));