Help with join

  • select table1.*, table2.*

    from Table1

    inner join Table2

    on Table1.Fall_ID = Table2.Fall_ID

    Replace my selection criteria with the fields you actually want.

    -Ki

    -Ki

  • Hi, Kiara,

    select

    waterfalls.ID,

    waterfalls.Fall_ID,

    waterfalls.Latitude,

    waterfalls.Longitude,

    Maps.Fall_ID AS Map_ID,

    Maps.Maps

    FROM waterfalls

    INNER JOIN Maps ON waterfalls.Fall_ID = Maps.Fall_ID

    like this?

  • xeops (3/1/2011)


    Hi, Kiara,

    select

    waterfalls.ID,

    waterfalls.Fall_ID,

    waterfalls.Latitude,

    waterfalls.Longitude,

    Maps.Fall_ID AS Map_ID,

    Maps.Maps

    FROM waterfalls

    INNER JOIN Maps ON waterfalls.Fall_ID = Maps.Fall_ID

    like this?

    That will get you all rows from waterfalls that have matching Fall_ID fields in Maps. I'm assuming that's what you want.

    If you want all rows from waterfalls whether or not they have a matching Fall_ID in Maps, then you'd do the same, but replace INNER JOIN with LEFT JOIN.

    -Ki

    -Ki

  • hi, Kiara,

    the above setup somwhow omits the Map.Fall_ID from the list of primary key fields when application is build, is it because the detail table is set as follows:

    Maps

    ID

    Fall_ID

    Lat

    Long

    should I remove ID as being autonumber and make Fall_ID a primary key instead?

  • xeops,

    I'm sorry, but debugging your build process is beyond my skill set. Wish I could help on that one.

    -Ki

    -Ki

  • no problems Kiara,

    I have solved it using DAL access layer

    '********** Insert a record into another table ************

    set dal_table=dal.Table("Maps")

    dal_table.Value("Latitude") =values("Latitude")

    dal_table.Value("Longitude") =values("Longitude")

    dal_table.Value("Fall_ID") =values("Fall_ID")

    dal_table.Add()

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply