I have a one to many relationship setup between quote and quote-detail tables.
In the details table i have accepted (yes/no) field.
Sometimes there are records that do not have any accepted line items.
I wrote a query that pulls everything ok as long as there is an item that has accepted = yes in the line items table.
If there were none I cannot get just the main table record.
Here's the sql. Hope it helps.
SELECT Orders.Ordernum, Orders.Quotenum, Orders.Customernum, Orders.QuoteDesc, Orders.Manufacturer, Orders.Cost, Projects.Projectname, Projects.ProjectDescription, Customers.CustomerName, Orders.Markup, Orders.CustomerCost, [Orders-Add].OrderLineNum, [Orders-Add].[add-Description], [Orders-Add].[add-Cost], [Orders-Add].[add-markup], [Orders-Add].[add-Accepted], [Orders-Add].[add-Total], Orders.Accepted, Orders.Description, Orders.Total, Orders.[Add-DeductTotal], Orders.Projectnum, Orders.Estimatenum, Orders.ManEstimateNum, Orders.Scope, Orders.Exclusions, Orders.From, Orders.Pages, Orders.RequestedShipDate, Orders.ManufacturerOrderNum, Orders.Createdon, Orders.ShiptoLine1, Orders.Shiptoline2, Orders.Shiptoline3, Orders.[EFCO Shop Drawings], Orders.[Customer Shop Drawings], Orders.
In the details table i have accepted (yes/no) field.
Sometimes there are records that do not have any accepted line items.
I wrote a query that pulls everything ok as long as there is an item that has accepted = yes in the line items table.
If there were none I cannot get just the main table record.
Here's the sql. Hope it helps.
SELECT Orders.Ordernum, Orders.Quotenum, Orders.Customernum, Orders.QuoteDesc, Orders.Manufacturer, Orders.Cost, Projects.Projectname, Projects.ProjectDescription, Customers.CustomerName, Orders.Markup, Orders.CustomerCost, [Orders-Add].OrderLineNum, [Orders-Add].[add-Description], [Orders-Add].[add-Cost], [Orders-Add].[add-markup], [Orders-Add].[add-Accepted], [Orders-Add].[add-Total], Orders.Accepted, Orders.Description, Orders.Total, Orders.[Add-DeductTotal], Orders.Projectnum, Orders.Estimatenum, Orders.ManEstimateNum, Orders.Scope, Orders.Exclusions, Orders.From, Orders.Pages, Orders.RequestedShipDate, Orders.ManufacturerOrderNum, Orders.Createdon, Orders.ShiptoLine1, Orders.Shiptoline2, Orders.Shiptoline3, Orders.[EFCO Shop Drawings], Orders.[Customer Shop Drawings], Orders.
Drawings said:, Orders.[Make Order Size], Orders.TotalnoMarkup, Orders.Commtotal, [Orders-Add].[Add-comm], Orders.Comments
FROM ((Orders INNER JOIN Projects ON Orders.Projectnum = Projects.Projectnum) INNER JOIN Customers ON Orders.Customernum = Customers.Customernum) INNER JOIN [Orders-Add] ON Orders.Ordernum = [Orders-Add].Ordernum
WHERE ((([Orders-Add].[add-Accepted])=Yes));
How can I write this to get records even if there are no detail records accepted?
Thanks.