[thelist] Regarding SQL query
Mohit Kumar Chauhan
Mohit.Chauhan at headstrong.com
Tue Nov 20 09:47:41 CST 2007
Hello,
I've following two tables:
1 HELP_TABLE
HELP_ID NUMBER NOT NULL,
HELP_HEADING VARCHAR2 (200),
CONSTRAINT PK_HELP_TABLE
PRIMARY KEY ( HELP_ID )
2 HELP_DETAILS
HELP_ID NUMBER,
HELP_SUB_ID NUMBER,
HELP_DESC VARCHAR2 (4000),
HELP_SUB_HEADING VARCHAR2 (500))
And HELP_DETAILS table references HELP_TABLE As follows
CONSTRAINT FK_HELP_TABLE_ID
FOREIGN KEY (HELP_ID)
REFERENCES CPLUS.HELP_TABLE (HELP_ID)
Now when I run the query below:
select hd.HELP_ID, hd.HELP_SUB_ID, hd.HELP_SUB_HEADING, hd.HELP_DESC,
ht1.HELP_HEADING, ht1.HELP_ID
from HELP_DETAILS hd, help_table ht1 where
hd.HELP_ID IN
(select ht.HELP_ID from help_table ht where
ht.HELP_HEADING like '%s%' )
and ht1.HELP_ID IN (select ht.HELP_ID from
help_table ht where ht.HELP_HEADING like '%s%' )
order by hd.HELP_ID, hd.HELP_SUB_ID;
It multiplies the columns of HELP_TABLE and HELP_DETAILS table and gives
the result. what should I do to get ht1.HELP_ID corresponding to
hd.HELP_ID Without multiplying the rows?
Pls. mail back if the question or table details are still not clear.
Regards,
Mohit Chauhan
***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.***
More information about the thelist
mailing list