File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes how to map more than three table. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to map more than three table." Watch "how to map more than three table." New topic
Author

how to map more than three table.

viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

I have three table into database named as:
1- program:
it contains following data field-(sr_no,package,programtype, )
2-enquiry:
it contains following data field-(sr_no,date, recieptno, amount, startdate, expirydate)
3-member:
it contains following data field-(sr_no,membername, trainername)

and i want to show the table as given bellow. but i am not getting that what will be sql select query for this...
can somebody write query for bellow table...

please reply me soon...

Report Details:

Date |Member Name| Package | Receipt No. | Amount | Trainer Name | Start Date | Expiry Date | Program Type |





thanks:
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Since you are asking about SQL I think you meant to post this in the JDBC forum Moving it there for you.


[How To Ask Questions][Read before you PM me]
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

I don't see how a query like this is possible with the tables as you have them. I don't see any relationships between these tables.
viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

I am really sorry....that i missed one column name sr_no in all three table..now i have added.
i would like to say thanks to Mr. Bill for the valuable suggestion...
so please reply me that what should be the sql select query for the above table??


waiting for your reply!
thanks..
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1772
    
  14

Vivek Bhardwaj wrote:I am really sorry....that i missed one column name sr_no in all three table..now i have added.
i would like to say thanks to Mr. Bill for the valuable suggestion...
so please reply me that what should be the sql select query for the above table??

You'll learn much more if you try working this out yourself, so take a look at this introduction to SQL joins, and you should be able to figure out how to join your tables using your common (key) column. Get the join condition right first, then you simply need to include the columns you want to fetch in your SELECT clause.


No more Blub for me, thank you, Vicar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to map more than three table.