help i need to join two or more tables to one 
Author Message
 help i need to join two or more tables to one

i need to join two or more tables to one
example

table 1= movimientos
aux tables= clientes , productos

select * from  movimientos left inner join clientes,productos
on movimientos.numcli = clientes.numcli
on movimientos,numprod = productos.numpro

Juan Angel Gra?a



Sat, 14 Sep 2002 03:00:00 GMT  
 help i need to join two or more tables to one

Hi,

this would be the correct SQL statement:

select * from movimientos
join clientes on movimientos.numcli = clientes.numcli
join productos on movimientos.numprod = productos.numpro

However, i'm not quite sure what you are trying to do.
There is no such thing as a LEFT INNER JOIN.

Hope this helps,
Jan Geert Hek

  i need to join two or more tables to one
  example

  table 1= movimientos
  aux tables= clientes , productos

  select * from  movimientos left inner join clientes,productos
  on movimientos.numcli = clientes.numcli
  on movimientos,numprod = productos.numpro

  Juan Angel Gra?a



Sun, 15 Sep 2002 03:00:00 GMT  
 help i need to join two or more tables to one
There are 3 tables in the database, located in "C:\temp\db1.mdb"
Movimientos, Clientes and Productos. They all share the key fields
MovieID, which means that the fields MovieID is in all of these tables as
the same data type and data size. The relationship between the 3 table is
One-To-One.

Table Movimientos and table Clientes share the field NumCli which means
that the field NumCli resizes in both tables as the same field name, the
same data type and the same data size.

Table Movimientos and table Productos share the field NumProd which means
that the field NumProd resizes in both tables as the same field name, the
same data type and the same data size.

The following code helps to update all records in the table Movimientos
with values from the other 2 tables Clientes and Productos.  If the fields
in the table Movimientos are empty or blank, they are filled with new
values.  In other sense you may say that the program joints the field
NumCli in the table Clientes and the field NumProd in the table Productors
into the table Movimientos.  It can joint as you said in the condition
that, there are already the key field MovieID in the table Movimientos
that is filled with all values.

Create a new and blank project with the default form. On the form, place a
command button and name it cmdUpdate. Copy and paste the following code
into your source code area, and you are ready to run it, pressing F5 key:

Option Explicit

Dim WrkSpc As Workspace
Dim DBase As Database
Dim strSQL As String

Private Sub cmdUpdate_Click()

On Error GoTo AnyErr

Set WrkSpc = CreateWorkspace("", "admin", "")
Set DBase = WrkSpc.OpenDatabase("C:\temp\db1.mdb")

strSQL = "UPDATE (Clientes " & _
    "INNER JOIN Movimientos " & _
    "ON Clientes.MovieID = Movimientos.MovieID) " & _
    "INNER JOIN Productos " & _
    "ON Clientes.MovieID = Productos.MovieID " & _
    "SET Movimientos.NumProd = [Clientes].[NumCli], " & _
        "Movimientos.NumCli = [Productos].[NumProd];"

DBase.Execute (strSQL)

MsgBox "Clientes and Productos are updated in Movimientos", _
    vbInformation, "Good News from AnhMy Tran"

Exit Sub

AnyErr:
    MsgBox Err.Description, vbCritical, "Bad News from AnhMy Tran"

End Sub

Good luck.

--
Posted via CNET Help.com
http://www.help.com/



Mon, 16 Sep 2002 03:00:00 GMT  
 help i need to join two or more tables to one
I am sorry I forgot to add that:

In your VB development Environment, click the Project Menu, then scroll
down the list, select "Microsoft DAO 3.5 Object Library."

Without "Microsoft DAO 3.5 Object Library" my source code cannot work.

Please, refer to my previous post for more information.

--
Posted via CNET Help.com
http://www.help.com/



Mon, 16 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. need help please:joined tables,add new entries based on one table columns

2. need help please:joined tables,add new entries based on one table columns

3. SQL - Join one table in one destination to another table in another destination (DBF)

4. Joining two tables from two databases

5. Here's a sticky wicket - joining two tables on two diffrent servers with ADO

6. Table join between two tables in different databases

7. Help Help Need to copy a field from one table into another table

8. Join several tables to ONE table

9. Comparing two tables and then updating one table.

10. joining two files as one

11. Join two recordsets into one using DAO 3.6?

12. Join two value into one variable

 

 
Powered by phpBB® Forum Software