I have an application where the users can define up to 5 extra fields for a particular table (e.g. tblMaster). The custom data is all held in one table (e.g. tblCustom) so there could be up to 5 records in tblCustom for each tblMaster record. In my application
I build a select statement based on the number of custom fields so that I can get a single row of data for each tblMaster record (sample below). I am now adding new features to the application and I want to expose an SQL View to the users for a report writer
that will achieve the same result but still cater for the variable number of custom fields. I realise this needs to use probably a RIGHT OUTER JOIN so that NULL is returned if there is no matching field but I can't work it out. If I had five separate
files it would be easy as each one would be a RIGHT OUTER JOIN for each. I could build 6 views (e.g. with no custom fields, with one custom field, with two custom fields etc) but that is not very efficient. I don't particulaly want to restructure the
database as there would be a lot of work and retesting.
Any help would be very welcome!
SELECT tblProcess.ProcessNumber, tblProcess.Process, tblProcess.Risk, tblProcess.MRR, tblProcess.Version, tblProcess.LastChange, tblProcess.SecurityLevel,
View Complete Post