• 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

Using JSP how du I work with jdbc (ms-access)

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
I have 4 tables, viz. problem, area, engineer and complaints. While storing the data in the table of complaints, the respective ids of former three are stored. While displayng the records of complaints, i am able to get the ids of the former tables viz. problem, area and engineer and not the names. The other fiels are displayed, fine.
My problem is how do I run a SQL query, such a way that I get the names of the above mentioned tables.
The tables are as follows:
1)probelm : probid, name.
2)area : areaid, name.
3)engineer: engid, engineer.
4)complaints: compid,custname,date,time,problem,area,engineer,status.
Pls help me !

 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is this what you meant? A join? Note: "problemname" and "areaname" are field aliases for your result set, because both fields originally have the same name "name".
A few comments though. Two fundamentally different types of things should, if at all possible, not have the same name. So, "problem.name" and "area.name" are fine, they refer to a similar things in different tables. But "engineer.engineer" and "complaints.engineer" are very different! The first is a name, the second is an id field. Try to adopt a naming convention for your id fields and others instead. For example:

  • problem: id, name
  • area: id, name
  • engineer: id, name
  • complaints: id, problemid, areaid, engineerid,...

  • Some people don't like things like "id" and "name" in tables, and would want you to use "problem_id" and "problem_name". That's fine too. As long as you're consistent.
    Furthermore, watch out with names like "date", "time", and perhaps also "status". In some databases they are reserved words, and to prevent problems you would always have to quote these field names (which leads you straight into the snake pit of case sensitivity if you don't watch out). Rather avoid them if you can.
    - Peter
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic