Page 1 of 1

problem with SQL query..

Posted: Tue Jul 04, 2006 2:40 am
by Zoran_Dimov
Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I  am trying to run this query on ORACLE database, and i can not fetch any record. 
[syntax="sql"]
SELECT * FROM Products WHERE PR_CATEGORY=9 AND PR_CODE=(SELECT PR_CODE FROM sub_categories_products WHERE SUB_CATEGORY_ID=4)
Can any one help me?

Thanks, Zoran Dimov


Weirdan | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Jul 04, 2006 2:43 am
by GM
Try

Code: Select all

SELECT * FROM Products WHERE PR_CATEGORY=9 AND PR_CODE IN (SELECT PR_CODE FROM sub_categories_products WHERE SUB_CATEGORY_ID=4) 

Posted: Tue Jul 04, 2006 11:32 am
by duk
try to see SELECT with DISTINCT your query could be much more faster then using with IN...

EDIT***

soz i saw that u using oracle... i dont know if oracle got DISTINCT...