Skip to main content
Inspiring
Jan 7, 2021 1:41 AM UTC
Question

Database related

I have one table say A, with location { delhi, patna, kanpur} and it's location id is {1,2,3} . I also have another table say locationjourney in which a person xyz travels from location id 1 to 3 and another person abc from 2 to 3. Now I need to display: person name(xyz)and location from ( delhi) to( kanpur)

    2 replies

    stewart.burchell
    Employee
    Jan 7, 2021 10:09 AM UTC

    What is your actual question? Is it "How does my data model need to be designed?" Or is it "How do I retrieve the relevant data from the tables and display it?". Or something else? 

    roopeshv
    New Participant
    Jan 7, 2021 11:26 PM UTC

    I am assuming your second table contains 3 columns : personName, locationFromID and locationToID. There can be different ways to retrieve data and display it but easiest nd best would to create a view in DB and read it directly. Something like

    Table2 left join table1 on table2.locationFromID = Table1.ID

    Left table1 on table2.locationToID = table1.id