File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
getting reciprocal values from a table
Joined: Jun 29, 2009
Jun 29, 2009 06:26:26
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:
c1 c2 ------- 1 4 1 3 1 2 4 2 4 1
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?
author & internet detective
Joined: May 26, 2003
Jun 29, 2009 17:38:01
How about doing a join (cartesian join that matches all of them) and see which come to the same value when diving a/b?
OCA 8 book
How To Ask Questions The Smart Way
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
subject: getting reciprocal values from a table
DB2 700 and 701 - Test Sample
JPA native query, group function, different entity
need help with design of a Login page in JSP
inner join Vs outer join
Regarding apply JOIN by using JPQL.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015