Re: Joining every row from 1 table to every row from another



radnor wrote:
The thing is to estimate costs of making any garment with any
materials. I need to join all garments to all materials, !

You're trying to produce what's called a Cartesian product.
This can be done in SQL simply by omitting any join condition. The default join (with no condition limiting it) joins every row in one table to every row in the other table:


SELECT GARMENT.*, MATERIAL.MATERIAL_NO
FROM GARMENT, MATERIAL;

This should work in Oracle, MySQL, or any other system that supports the most rudimentary features of SQL.

Regards,
Bill K.
.



Relevant Pages

  • Re: embedded SQL in COBOL
    ... I still have 'Learner' plates up for SQL - fortunately with N/E, having defined your DB, it allows you to select Query Type and it generates from EXEC to END-EXEC including the troublesome NULLs. ... DBI Main. ... Not shown in the above flowchart is a template for Dialogs to which I pass creation parametersand subsequently send data or receive data back - using the class Edit Materials as the Controller, ). ... MakeCollection - CURSOR SELECT DISTINCT ...
    (comp.lang.cobol)
  • Re: Trigger not updating in all conditions
    ... INSERT INTO MATERIALS ... TRIGGER FOR INSERT,UPDATE,DELETE IN MATERIALS TABLE ... row in Stock, there can only be one row in INSERTED with the ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)
  • Re: c++ and database
    ... > languages using ODBC and SQL. ... > materials which make me work with this databases (I use Borland free ...
    (comp.lang.cpp)
  • Re: join conditions for files
    ... The problem is in the join condition with '$' ... But SQL LIKE is allowed and a UDF is allowed. ... FUNCTION yourudf(tcContained, tcContains) ... Don't use local aliases made of one letter only, they may confuse Foxpro, since they are reserved names for workspace aliases. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: problem with multiple join table query on report
    ... PAYMENT, SumAS DLABOR, SumAS ... MATERIALS ... if only the SOREPORT AND TRANSACTION table is joined i do get the data that i ... We'd be glad to help if we could but since you have not posted the SQL of the ...
    (microsoft.public.access.modulesdaovba)