• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving data from JDBC using XML

 
Ling Min Lee
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got 3 tables in JDBC, namely A, B and C

A
aArea
aLocation
hotelID

B
bArea
bLocation
hotelID
locationID

C
cArea
cLocation
locationID

I would like to do a search and display ALL locations when i choose an Area (North, South,Central). I thought of using:

SELECT a.aLocation, b.bLocation, c.cLocation
FROM a, b, c
WHERE a.hotelID = b.hotelID
AND b.locationID = c.locationID
AND a.aArea = 'NORTH';

But it cant be executed cuz i want to do a search for locations using area from ALL 3 tables. Please help..

If there is no such commands, am i supposed to use XML?

There are no problems with the logic of the databases cuz the project i am doing supposed to do a dynamic search page with 3 variables.

Thank You.

[ August 24, 2004: Message edited by: Ling Min Lee ]

[ August 24, 2004: Message edited by: Ling Min Lee ]

[ August 24, 2004: Message edited by: Ling Min Lee ]

[ August 24, 2004: Message edited by: Ling Min Lee ]
[ August 24, 2004: Message edited by: Bear Bibeault ]
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ling Min Lee,

There's no need for XML here. XML is fundamentally a way of representing data in a highly structured text file; it won't help you with your query. SQL is the right way to go here. Try this:

Does that solve your problem? I think the database design looks rather dubious, but it's difficult to comment further without knowing more about the problem domain. It is useful (essential?) to know the primary keys for each table when writing an SQL query.

Hope that helps.

Jules
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic