How to match unique ID from the different table in database and retrieve data according to that unique ID in Java?

StackOverflow https://stackoverflow.com/questions/10324773

Question

Table user in database(postgresql) has unique id for each user, dob, first and last names of the user; Table points in database has userID and gamePoints columns.

In java servlet, how do I match and retrieve who exactly that user is with points and output? Fuzzy Match??

example:

Table user:
userID-name-lastname-dob
1-Edward-Maka-1950
2-Kapu-Aka-1990
3-Park-Lewins-1993

Table points:
userID-gamePoints
1-320
3-3312
2-1001
Était-ce utile?

La solution

Isn't this just a matter or writing an appropriate query and parsing the results from the ResultSet in Java?

The query should be something like:

SELECT user.userID, user.name, user.lastname, user.dob, points.gamePoints
FROM user, points
WHERE user.userID = points.userID 
  AND (user.name = ? OR user.lastname = ?)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top