>Delphi 3.02
>MS Access 95
>I am obviously describing this problem very badly!
>My query is:
>I have a database with two tables 'Orders' and 'ItemLn' which
>are linked by a common 'Order_Number' value.
>I have a DataModule with two TQuery components 'QueryOrders'
>and 'QueryItemLn' each has it's own DataSource which I have
>called 'dsOrdersTbl' and 'dsItemLnTbl'
>I have set up the DataSource property of the DBGrid which
>is used to display the result of the SQL query to DataSource
>'dsOrdersTbl' (Only one DataSource!?)
>When I run the SQL query (shown below) only the fields belonging
>to the 'Orders' table are returned. I would like the fields from
>both the 'Orders' AND the 'ItemLn' table to be returned and
>displayed on the same DBGrid.
>How is this done? Can it be Done?
>I am new to Delphi and must be overlooking something.
>Stephen Fowler
>email: s.fow...@qub.ac.uk
> QueryOrders.Close;
> QueryOrders.Sql.Clear;
> { Load SQL query }
> QueryOrders.SQL.Add('SELECT Orders.Order_Number, Orders.Date,');
> QueryOrders.SQL.Add('ItemLn.Description, ItemLn.Cost');
> QueryOrders.SQL.Add('FROM Orders, ItemLn');
> QueryOrders.SQL.Add('WHERE Orders.Order_Number = ItemLn.Order_Number');
> { Add MS Access SQL query terminator }
> QueryOrders.SQL.Add(';');
> { Run SQL query }
> QueryOrders.Open;