|
morning guys. Is it best to have have a like this SELECT
job.Order_Date,
job.AttendBy,
job.End_Date,
job.File_No,
job.Job_No,
job.CustomerId,
job.CustomerId AS customerPK,
job.CustomerId AS Customer_Name,
job.CustomerEmail,
job.Contract,
job.Job_Description,
job.VAT,
job.Invoice_Printed,
job.Invoice_Printing_Date,
job.Invoice_Tax_Date,
job.Payment_Received,
job.Job_Finished,
job.CustomerRef,
job.Payment_Due_date,
job.Payment_Date,
job.Note,
job.EngineerId,
job.EngineerId AS PDAAllocation,
job.EngineerId AS GasId,
job.LocationId,
job.LocationId AS locationPK,
job.LocationId AS Order_Site_Address,
job.LocationId AS SiteEmailAddress,
job.LocationId AS SitePhoneNumber,
job.JobTypeId,
job.JobTypeId AS JobSheet,
job.Exported,
job.Logged_By,
job.Logged_By AS ContactEmail,
job.PhoneNumber,
job.ResponseCatagories,
job.CallerName,
customer.Customer_Name AS CustomerName,
sites.site_address AS SiteAddress,
account.Engineer_Note AS Engineer,
sites.SPost_Code
FROM job
INNER JOIN customer ON job.CustomerId = customer.CustomerId
INNER JOIN sites ON job.LocationId = sites.LocationId
INNER JOIN account ON job.EngineerId = account.EngineerId
ORDER BY job.Job_No DESC
Or make my job table bigger and write all the info in there in the first instance so its not looking across tables, so it would be like this
SELECT
job.Order_Date,
job.AttendBy,
job.End_Date,
job.File_No,
job.Job_No,
job.CustomerId,
job.customerPK,
job.Customer_Name,
job.CustomerEmail,
job.Contract,
job.Job_Description,
job.VAT,
job.Invoice_Printed,
job.Invoice_Printing_Date,
job.Invoice_Tax_Date,
job.Payment_Received,
job.Job_Finished,
job.CustomerRef,
job.Payment_Due_date,
job.Payment_Date,
job.Note,
job.EngineerId,
job.PDAAllocation,
job.GasId,
job.LocationId,
job.locationPK,
job.Order_Site_Address,
job.SiteEmailAddress,
job.SitePhoneNumber,
job.JobTypeId,
job.JobSheet,
job.Exported,
job.Logged_By,
job.ContactEmail,
job.PhoneNumber,
job.ResponseCatagories,
job.CallerName,
job.Customer_Name AS CustomerName,
job..site_address AS SiteAddress,
job..Engineer_Note AS Engineer,
job.SPost_Code
FROM job
ORDER BY job.Job_No DESC
It depends to what you need to do with your data,
but for me I think better to create different tables and play with any query as mush asyou need instead of having all fields in one table
|