SQL Syntax: SUM as part of JOIN statements
Posted on 2007-08-09
Given a working sql statement:
SELECT events.*, venuedb.name AS venue_name, venuedb.city AS venue_city, clients.organization, clients.first_name+' '+clients.last_name AS client_name, client_type
(events INNER JOIN venuedb ON events.event_location_id = venuedb.venueid)
INNER JOIN clients ON events.clientid = clients.clientid)
INNER JOIN djemployee ON events.assigned_dj = djemployee.djemployeeid
I want to include the following:
SUM (events.assigned_dj_fee+events.assigned_dj2_fee+events.assigned_dj3_fee+events.assigned_dj4_fee+events.assigned_dj5_fee) AS event_employee_wages
I have tried placing this in a few different places in the query, but so far no joy.
I am using MS Access for the Database and Classic ASP.
If this is possible, will it slow down the query quite a bit? Otherwise I can create a separate recordset, put it into an array and cross-reference
Maybe a left join would be a better idea?