Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get a the data of the first row?

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

How can I get information from 2 tables while the second table should return only the FIRST row (if exist)

Example
I have 2 tables A & B

A: Name, age, ID

B: ID, employees

I�d like to receive an output of all items in table A with the first match in Tables B

Example

A:
James, 33, 00112
John, 25, 00113
Bill, 53, 00114

B:
00112, Mark
00112, Ron
00112, Dan
00113, Sarah
00113, Daniel


The output should be:

James, 33, 00112, Mark
John, 25, 00113, Sarah
Bill, 54, 00114, null


Thanks for any thoughts.
Peter
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which ORM are you using?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic