• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying records from multiple table

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I need your help to display records from multiple tables (tbl_users, tbl_dependants), I want to display user information in one row and user dependants in a column after ending user information, the two tables are related with (user_id). When the first user recordSet finishs displaying all user information + his dependants, it goes to the next line and print another user details,,, and so on.

I searched the entire forum for a help but I couldn't find.

Best Regards,
[ January 05, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What part are you having trouble with, the SQL, parsing the results?
What have you got so far?

There are a lot of ways to get from the database to the browser.
 
Bashar Ayyash
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got so far, one row of user details + his dependants and a second row of another user details but without his dependants.

there is a little thing I must do but I couldn't figure it.

thanx for the help,
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your SQL statement could be written like this:



Hope that helps. They are called joins and you should read up on them.

You could also query all the names from the 1st table, loop through them and on each loop query for the dependents associated with that users name. That's not a very efficient way to do it, however.
[ January 05, 2006: Message edited by: Matt Gatten ]
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic