A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
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
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
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