sql question [message #54097] |
Tue, 29 October 2002 08:46 |
tma
Messages: 5 Registered: October 2002
|
Junior Member |
|
|
I have the following sql statement:
update doc_set_coverpage_t
set line_text =(SELECT FILING_NAME FROM filing_t where filing_key in (select filing_key from doc_set_filing_map_t where doc_set_key in (select doc_set_key
from doc_set_t
where PROCEEDING is not null
or TESTIMONY is not null
or DOCKET_NUM is not null)))
WHERE doc_set_key in (select DOC_SET_KEY from doc_set_filing_map_t where doc_set_key in (select doc_set_key
from doc_set_t
where PROCEEDING is not null
or TESTIMONY is not null
or DOCKET_NUM is not null))
and line_num = 5;
This gives me an error saying single row subquery returns more than one row, this of course works if the sub select returns only one row... I can t figure out how to put the where exists clause for it to work with more than one row result set. Any ideas? Thanks..
|
|
|
Re: sql question [message #54098 is a reply to message #54097] |
Tue, 29 October 2002 09:44 |
Tommy Petersen
Messages: 5 Registered: October 2002
|
Junior Member |
|
|
I assume that you are looking for the same FILING_KEY in all the tables, and there is only one FILING_T table for each FILING_KEY.
I suggest that you use a corrolated sub_query to minimize the number of result rows in the sub queries and then use the MAX function to get only one.
The way you have set up the query you will get all rows returned that matches the WHERE clause.
You can email me directly if you need more detailed information.
|
|
|
Re: sql question [message #54173 is a reply to message #54097] |
Fri, 01 November 2002 09:24 |
Paul Cruz
Messages: 4 Registered: November 2002
|
Junior Member |
|
|
Hi Tommy.
I sure would like to try and provide suggestions. But before I do, I would need some more information.
Is it possible to provide the primary/unique key fields for all the tables in your SQL statement.
Tables used are as follows:
doc_set_coverpage_t
filing_t
doc_set_filing_map_t
doc_set_t
|
|
|