mapping of row in one table to column in another table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steffy john
    New Member
    • Jan 2014
    • 1

    mapping of row in one table to column in another table?

    i have a data set where in i take value from one table which itself is a column in another table. it would look something like this.

    TABLE1

    ID CATEGORY ACTIVITY
    551 ML ART
    552 PTL SWEEPS
    553 RDC PIPO
    554 ML PIPO

    TABLE2

    ACTIVITY ML PTL RDC
    ART 10 15 15
    PIPO 15 15 11
    SWEEPS 12 10 15

    NOW SUPPOSE I WANT FOR 551 ID AND CATEGORY 'ML' IN TABLE1 TO FETCH VALUE OF ML i.e '10' IN TABLE2 FOR ACTIVITY 'ART'.
    how do i do this in sql?
    Thanks in advance.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The problem is that your table is improperly designed in that it is not normalized. You should not have a field for each category, instead, you should just have a category field like you do in table1. That way you can join on activity and category to get the value.

    For more information, please read our article on normalization: http://bytes.com/topic/access/insigh...ble-structures

    Comment

    Working...