using subquery on this results in 4.1.17, help pls
Posted by: adetokunbo bamidele
Date: December 08, 2004 06:39AM

hi folks,

got a tough one here.

what is the best way based on performance to achive the following scenario

I would like to retrieve the top '10' images (saved as filepath) from db based on a query.

the ethos here is

my query image will return the first top ten image filepaths closest to the 'query image'

that is i have distance values computed and stored in my tables, don't ask as i have to write 10 pages to explain how it is computed, so the first filepath returned will be itself with value '0' followed by the next value, this in aescending order.

my query works and looks like

SELECT imageb,imagea,smgv FROM similarity_link
WHERE imagea = 'image01'
AND SMGV BETWEEN "0" AND "500000" ORDER BY RANK LIMIT 10;


results looks like

imagea = image01

imageb smgv
image01 0
image02 50
image03 90
image04 100
image05 110
image06 115
image07 120
image08 125
image09 200
image10 250


fine this works ok,

but now how can i reuse the second "smgv" of my result set, in this case image02 ->50 to retrieve more images, in this case, i may be looking at 9 transactions based on the first query result in this scenario.



how do i use 'subquery' function in 4.1 to acheive my objective here from the above SQL statement and results

can anyone help pls.

Options: ReplyQuote


Subject
Views
Written By
Posted
using subquery on this results in 4.1.17, help pls
4485
December 08, 2004 06:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.