I have two tables like
Table A
Index1, Index2, Location
Table B
Index1, Index2, Result_type, Result
(So each row represents one result_type & result pair)
And i'd like to have a table like
Index1, Index2, Location, Result, Result, Result...
(Where all results are inserted in predefined resulttype columns like Tempereture, Oxygen etc...)
Joining
Moderator: General Moderators
Needs rewriting, but the basics are there. The problem with joining tables that have the same fieldsnames on both, are that the query itself will not know what (in this case) index1 is witch etc.
But by naming them as in the example, you can bypass this.
Hope it gave you enough ideas to work with.
But by naming them as in the example, you can bypass this.
Code: Select all
select
tablea.index1 as 'a-index1',
tablea.index2 as 'a-index2',
tablea.location,
tableb.index1 as 'b-index1',
tableb.index2 as 'b-index2',
tableb.result_type as 'restype',
tableb.result
from
tablea
inner join tableb on tablea.index1 = tableb.index1-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am