Board index » delphi » In between table to show a selection in third table

In between table to show a selection in third table

Hello,

My tables are related as follows:

Table1.Fields: Machine.
InBetweenTable.Fields: Machine, Group, Partnumber
Table2.Fields: Partnumber, (and a lot of others which is supposed to be
displayed in a grid)

in this way I hope to make a 'fast picking list' of partnumbers of one group
spesified in InBetweenTable.

To avoid that all the fields to be displayed  in Table2 have to be
duplicated  in the InBetweenTable of the groups, I want to only use
InBetweenTable as a link to the real records in Table2
So, can I somehow have a grid showing only the items in Table2 that have the
same partnumbers as those items in the InBetweenTable table?

i.e if I select a machine and a partgroup, the partgroups related
partnumbers are displayed from Table2.
I must be able to jump quick from one group to the next, to inspect the
list.

If this is possible, I will save a lot of duplicates.

Any suggestions are welcome.

--
:)
Kai Inge

There's no such thing as an innocent user
-- Dark Avenger, in a Wired interview

 

Re:In between table to show a selection in third table


Use two queries in a master-detail relation, e.g.

Query1.SQL.Text :=
  'SELECT Table1.*, InBetweenTable.Group ' +
  'FROM Table1 INNER JOIN InBetweenTable ' +
    'ON (Table1.Machine = InBetweenTable.Machine) ' +
  'ORDER BY Table1.Machine';
DataSource1.DataSet := Query1;
Query2.SQL.Text :=
  'SELECT DISTINCT Table2.* ' +
  'FROM Table2 INNER JOIN InBetweenTable ' +
    'ON (Table2.Partnumber = InBetweenTable.Partnumber) ' +
  'WHERE (InBetweenTable.Machine=:Machine) ' +
  'AND (InBetweenTable.Group=:Group)';
Query2.MasterSource := DataSource1;
DataSource2.DataSet := Query2;

"Kai Inge Buseth" <ki...@c2i.net> schreef in bericht
news:AKD57.3462$em.112347@juliett.dax.net...

Quote
> Hello,

> My tables are related as follows:

> Table1.Fields: Machine.
> InBetweenTable.Fields: Machine, Group, Partnumber
> Table2.Fields: Partnumber, (and a lot of others which is supposed to be
> displayed in a grid)

> in this way I hope to make a 'fast picking list' of partnumbers of one
group
> spesified in InBetweenTable.

> To avoid that all the fields to be displayed  in Table2 have to be
> duplicated  in the InBetweenTable of the groups, I want to only use
> InBetweenTable as a link to the real records in Table2
> So, can I somehow have a grid showing only the items in Table2 that have
the
> same partnumbers as those items in the InBetweenTable table?

> i.e if I select a machine and a partgroup, the partgroups related
> partnumbers are displayed from Table2.
> I must be able to jump quick from one group to the next, to inspect the
> list.

> If this is possible, I will save a lot of duplicates.

> Any suggestions are welcome.

> --
> :)
> Kai Inge

> There's no such thing as an innocent user
> -- Dark Avenger, in a Wired interview

Re:In between table to show a selection in third table


Thank you very much for your detailed answer.
I need it that detailed, because I never have used SQL before, only tables.
Now I will try it out.

Thanks again.

:)
Kai Inge

Quote
"M.H. Avegaart" <avega...@NOSPAMmccomm.nl> wrote in message

news:9j94a4$4s$1@scavenger.euro.net...
Quote
> Use two queries in a master-detail relation, e.g.

> Query1.SQL.Text :=
>   'SELECT Table1.*, InBetweenTable.Group ' +
>   'FROM Table1 INNER JOIN InBetweenTable ' +
>     'ON (Table1.Machine = InBetweenTable.Machine) ' +
>   'ORDER BY Table1.Machine';
> DataSource1.DataSet := Query1;
> Query2.SQL.Text :=
>   'SELECT DISTINCT Table2.* ' +
>   'FROM Table2 INNER JOIN InBetweenTable ' +
>     'ON (Table2.Partnumber = InBetweenTable.Partnumber) ' +
>   'WHERE (InBetweenTable.Machine=:Machine) ' +
>   'AND (InBetweenTable.Group=:Group)';
> Query2.MasterSource := DataSource1;
> DataSource2.DataSet := Query2;

> "Kai Inge Buseth" <ki...@c2i.net> schreef in bericht
> news:AKD57.3462$em.112347@juliett.dax.net...
> > Hello,

> > My tables are related as follows:

> > Table1.Fields: Machine.
> > InBetweenTable.Fields: Machine, Group, Partnumber
> > Table2.Fields: Partnumber, (and a lot of others which is supposed to be
> > displayed in a grid)

> > in this way I hope to make a 'fast picking list' of partnumbers of one
> group
> > spesified in InBetweenTable.

> > To avoid that all the fields to be displayed  in Table2 have to be
> > duplicated  in the InBetweenTable of the groups, I want to only use
> > InBetweenTable as a link to the real records in Table2
> > So, can I somehow have a grid showing only the items in Table2 that have
> the
> > same partnumbers as those items in the InBetweenTable table?

> > i.e if I select a machine and a partgroup, the partgroups related
> > partnumbers are displayed from Table2.
> > I must be able to jump quick from one group to the next, to inspect the
> > list.

> > If this is possible, I will save a lot of duplicates.

> > Any suggestions are welcome.

> > --
> > :)
> > Kai Inge

> > There's no such thing as an innocent user
> > -- Dark Avenger, in a Wired interview

Other Threads