Skip to main content
Inspiring
January 7, 2021
Question

Database related

  • January 7, 2021
  • 2 replies
  • 0 views

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
    Participating Frequently
    January 7, 2021

    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
    January 7, 2021

    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