I hope this is the right fórum to post. I need to make a query to extract data from three tables.The tables are:CustomerCREATE TABLE [Customer] ([CustomerCode] VARCHAR(20) PRIMARY KEY NULL,[CustomerName] VARCHAR(60) NULL,[CustomerNif] VARCHAR(10) NULL,[CustomerAddr] VARCHAR(120) NULL,[CustomerZipCode] VARCHAR(40) NULL,[CustomerCity] VARCHAR(20) NULL,[CustomerState] VARCHAR(20) NULL,[CustomerCountry] VARCHAR(4) NULL,[CustomerPhone1] VARCHAR(20) NULL,[CustomerPhone2] VARCHAR(20) NULL,[CustomerPhone3] VARCHAR(20) NULL,[CustomerFax] VARCHAR(20) NULL,[CustomerEmail] VARCHAR(40) NULL,[CustomerWebSite] VARCHAR(40) NULL,[CustomerContact1] VARCHAR(40) NULL,[CustomerContact1Position] VARCHAR(40) NULL,[CustomerContact1Phone] VARCHAR(20) NULL,[CustomerContact1BusinessEmail] VARCHAR(60) NULL,[CustomerContact1PrivateEmail] VARCHAR(60) NULL,[CustomerContact2] VARCHAR(40) NULL,[CustomerContact2Position] VARCHAR(40) NULL,[CustomerContact2Phone] VARCHAR(20) NULL,[CustomerContact2BusinessEmail] VARCHAR(60) NULL,[CustomerContact2PrivateEmail] VARCHAR(60) NULL)
SupportHistoryCREATE TABLE [SupportHistory] ([IncidentID] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,[IncidentCustomerCode] NUMERIC NULL,[IncidentCustomerContact] VARCHAR(20) NULL,[IncidentDesc] VARCHAR(1024) NULL,[IncidentOpenedBy] INTEGER NULL,[IncidentTechInCharge] INTEGER NULL)
and SupportIncidentHistoryCREATE TABLE [SupportIncidentHistory] ([IncidentID] INTEGER PRIMARY KEY NOT NULL,[IncidentChangeDate] VARCHAR(10) NULL,[IncidentChangeTo] VARCHAR(1) NULL,[IncidentReasonToChange] VARCHAR(40) NULL,[IncidentComents] VARCHAR(256) NULL)
The Fields I'm Interested on are:From Customer Table: CustomerNameFrom SupportHistory Table:IncidentDescIncidentTechInChargeFrom SupportIncidentHistory Table:IncidentChangeToIncidentChangeDateI wrote this SQL Query based in several tutorial on the net:"SELECT c.CustomerName, sh.IncidentDesc, sh.IncidentTechInCharge, sih.IncidentChangeTo, sih.IncidentChangeDate FROM Customer c INNER JOIN SupportHistory sh ON c.CustomerCode = 'sh.IncidentCustomerCode' INNER JOIN SupportIncidentHistory sih ON sh.IncidentID = sih.IncidentID"
but it does not return any results. Can someone help me with the query?Thank You