• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting reciprocal values from a table

 
Taffy Smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Is there a way I can write an sql query to return reciprocal values from a single table?

for example, if I have the following rows:



can I write a sql query that will return the first, and last row, since they have a reciprocal relationship? Or would I need to use a stored procedure with a cursor to loop through them all?

Thanks,
Taf
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34205
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taf,
How about doing a join (cartesian join that matches all of them) and see which come to the same value when diving a/b?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic