problem with SQL query..

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Zoran_Dimov
Forum Newbie
Posts: 16
Joined: Wed Jun 21, 2006 6:10 pm
Location: Macedonia
Contact:

problem with SQL query..

Post 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]
GM
Forum Contributor
Posts: 365
Joined: Wed Apr 26, 2006 4:19 am
Location: Italy

Post 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) 
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post 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...
Post Reply