More Than One Value Was Returned By A Subquery Teradata

Create a user-named trigger to execute user-named subprograms defined in a form document from menu PL/SQL commands and user-named subprograms. (*) Yes, you can just list as many rows as you want; just remember to separate the rows with commas. This kind of subqueries are also known as column subquery. This is not permitted when the subquery follows =, !=, , = , = or when the subquery is used as an. Note: A subquery that you use as a field alias cannot return more than one field. Subquery returned more than 1 value. ClassId = b. When the rows to be read can be read during the optimization phase (for example, by reading index rows), there is no need to read any tables during query execution. But, like I said, if you just need a simple list with one record per group in a one-to-many query, this is an option that I discovered yesterday. SELECT (SELECT ID_FUNC FROM P_ISIDB. Not to mask the problem, but if your selects return more than one record, you could always change it to SELECT TOP 1 to only return one record (this usually works when you only want the latest record and you can also add a ORDER BY to get the most current record). Who are the department managers whose salaries are less than 550000 and whose budget amounts are greater than 950000? SELECT last_name,first_name FROM employee WHERE salary_amount< 550000 AND (SELECT manager_employee_number FROM department WHERE budget_amount. This kind of subqueries are also known as single-value subquery or scalar subquery. You probably meant to correlate the sub-query to the main query, where you use a value from the row being updated (rather than a copy of the table being updated) in the sub-query. 0000 10 Atkinson 100000. So whenc \er null values all; likely to be part of the result and set of a subquery, do not use the NOT IN operator. For example, to get films that have the returned date between 2005-05-29 and 2005-05-30, you use the following query:. Kolon adını az çok biliyorum ancak database' imde 123 (belki daha fazla) tablo var ve hangisinde bu kolon adını geçtiğini bilmiyorum. The subquery might also be of a type that doesn’t use parameters but has references to an outer query. This is not permitted when the subquery follows =, !=, , = , = or when the subquery is used as an. Not to mask the problem, but if your selects return more than one record, you could always change it to SELECT TOP 1 to only return one record (this usually works when you only want the latest record and you can also add a ORDER BY to get the most current record). If you are strictly following standards then use SET instead of SELECT. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. I first tried to break out the correlated subqueries to Common Table Expressions(CTE). As it turned out for me the trigger was only relevant for one particular supplier (an IF condition in the trigger), also luckily for me, the previous occupant of my position hadn't reviewed this trigger, and it was no longer needed. If a subquery returns no values, and if a quantifier is not used, then the result of the comparison is false. A subquery is evaluated as a semi-join only with these limitations: There can only be one table in the subquery. Incorrect Incorrect. This kind of subqueries are also known as single-value subquery or scalar subquery. A subquery is also called an inner query. Single row subquery : Returns zero or one row. We sell many "single unit" items that come in a can or bottle. Subquery returned more than 1 value error when using Update-Database in Entity Framework (SQL) - Codedump. Rate this: Please Sign up or sign in to vote. Remedy: Revise the predicate by specifying ANY before the subquery or revise the subquery so that it. The statement has been terminated. -284 A subquery has returned not exactly one row. A multiple-value subquery can return more than one value from one column. The “where” clause indicates that you want to return just customers with an id of 5. The Oracle / PLSQL NVL function lets you substitute a value when a null value is encountered. The Transact-SQL language offers the ability to compare a column value to the result of another select statement. "Subquery returned more than 1 value. Msg 512, Level 16, State 1, Procedure trg_pricebase, Line 13 Subquery returned more than 1 value. We would like to show you a description here but the site won't allow us. SQL Server ‘Subquery Returned More Than 1 Value’ Hatası Yazdığınız sql cümlelerinde yeri geldiğinde subquery ile veri alma ihtiyacı duyabiliyorsunuz 1 kayıt gelmesi gereken durumlarda 1’den fazla kayıt geldiğinde bu hatayı vermesi olası bir durumdur. We will use our student table where each student mark is stored in a field. Subquery returned more than 1 value. It then checks for one more matching rows in second table based on being used in the join using an index (primary or secondary) and returns the matching results. It combines subquery processing and join processing into a single request. This Oracle tutorial explains how to use the Oracle / PLSQL NVL function with syntax and examples. PostgreSQL Subqueries: Using Comparisons. This is not permitted when the subquery follows =, !=, <, <=, >, >= or when the subquery is used as an expression. There can be more than one subquery returning information to the outer query. user9093700 Nov 30, 2012 2:29 AM ( in response to Ashu_Neo ) HI ashu, actually the script was correct but i was not suppose to update one row but all the rows. You can use a subquery field alias to display values that depend on other values in the current row, which is not possible without using a subquery. Search Results related to subquery returned more than 1 value on Search Engine. ORA-01427: single-row subquery returns more than one row In the example above, the subquery returns multiple rows, so the outer query could not evaluate the equals sign. NOT IN returns true if the expression is not a member. Flattening Out Data with One of the Coolest SQL Tricks Ever Not sure why, but I seem to be on a T-SQL kick lately - so here's another T-SQL post. (ex: SELECT o. more than one value was returned by subquery Here is the query code that causes an error "more than one value was returned by subquery'. I know that it has to do with the fact that I'm using a subquery to get the last name and first name of the supervisor, and I know that it has to do with the fact that there is more. SqlException: Subquery returned more than 1 value. Subquery returned more than 1 value. Correct Correct 2. If exactly one row of data is returned, the values from the row are assigned to the corresponding host variables specified in the INTO clause. None returned. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Create a user-named trigger to execute user-named subprograms defined in a form document from menu PL/SQL commands and user-named subprograms. A subquery like. The reason is that all conditions that compare a null value result in a null. 21 pounds, etc. Msg 512, Level 16, State 1, Procedure trig_NotificationProduct, Line 19 Subquery returned more than 1 value. The content posted here is free for public and is the content of its poster. The ANY operator compares every value returned by the subquery. For each column, if there is no value to return, the subquery returns NULL. Error: Subquery returned more than 1 value. At most one record can be returned by this subquery. When more than one expression is provided in the DISTINCT clause, the query will retrieve unique combinations for the expressions listed. A subquery, like any query, returns a set -- hence, "IN (subquery)" is nothing more than "IN {set}", one of the three relational operations. and other features like AUTOMATED STATISTICS MANAGEMENT,ROW-LEVEL SECUIRITY,EQUITY JOIN FOR SKEW TABLES and much more. ClassId WHERE ClassCategory =. Native error: 512. Some mathematically equivalent queries can have drastically different performance. More than one column can consist of a primary key – upto 64 columns 3. A subquery that evaluates to a table with one or more rows, but is limited to only one column in its select list. and BranchID=(Select BranchID from Damagedcategory where DamagedID in This is where your query might be returning more than one value. DELETE records from a table You can delete the records from a table from DELETE or DEL keyword. Executed as Single statement. So in those ideal situations when one method has the same symantics as the other one (ie will generate the same answer set for all given data values), the optimizer will generate the same plan irrespective of what operator you used. Use the aggregate function MAX() which will guarantee that exactly only one value is returned and the subquery is syntactically valid. Who are the department managers whose salaries are less than 550000 and whose budget amounts are greater than 950000? SELECT last_name,first_name FROM employee WHERE salary_amount< 550000 AND (SELECT manager_employee_number FROM department WHERE budget_amount. This query may return more than 10 rows if there are multiple rows with the same value for price within the top ten. The subscripts of an array value built with ARRAY always begin with one. Solved: Hi all, I am very new to jira and has not even used scripts uptil now. The subquery can return at most one value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Using EXISTS and NOT EXISTS in correlated subqueries in MySQL 6. There is a possibility that more than one order exist for a given customer and date. 0000 10 Atkinson 100000. Other articles discuss their uses in other clauses. But, like I said, if you just need a simple list with one record per group in a one-to-many query, this is an option that I discovered yesterday. SQL Server. NOT IN Logic ~ Multiple Correlations ~. View 2 Replies View Related Subquery Returned More Than 1 Value Aug 28, 2007. 3669 More than one value was returned by a subquery. The group_by_list can be one or more columns or expressions and can optionally include the CUBE / ROLLUP keywords for creating crosstab results. When assigning from a query that returns more than one value, SELECT will assign the last value returned by the query and hide the fact that the query returned more than one row. [SqlException (0x80131904): Subquery returned more than 1 value. and BranchID=(Select BranchID from Damagedcategory where DamagedID in This is where your query might be returning more than one value. In your case, the subquery is returning more than one. Using Knowledge Exchange™, store valuable company content, including videos, articles, training materials, and more. 5340=====Database name, if specified, must be the login user name for a volatile table. Aggregate Functions and Datatypes You can use sum and avg with numeric columns only— int , smallint , tinyint , decimal , numeric , float , and money. The following queries are equivalent. Select when group by contains more than one row with the same value? 0. In other words, as long as the SalesQuota value exceeds any one value returned by the subquery, that row is returned. The statement has been terminated. Re: Subquery returned more than 1 value. Teradata allows up to 64 combined columns to make up the one Primary Index required for a table. Subquery returned more than 1 value. SellerID, SUM(TransactionFee) as TransactionFees, SUM(Quantity*a. Using subquery to return one ore more rows of values (known as row subquery) 5. Only if the subquery returns at least one row does this condition be true. Teradata SQL CASE statement with Example. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL. The statement has been terminated. True (*) False. When publishing report cards or transcripts to NetClassroom, you receive the error: Error: General ODBC Error: [Microsoft][ODBC SQL Server Driver][SQL Server] Subquery returned more than one value. A subquery can be used before or after any of the comparison operators. This is not permitted when the subquery follows =, !=, , = , , = or when the subquery is used as an expression. A subquery is evaluated as a semi-join only with these limitations: There can only be one table in the subquery. I have a sub query that returns more than one value. It deletes a macro out of the DD. In this statement, a subquery has returned more than one row, and the database server cannot choose which returned value to use in the expression. Here are your likely. ERROR: more than one row returned by a subquery used as an expression SQL state: 21000 I know each select subquery return s multiple rows but I dont know how to rectify it. NumIntAut IN ( CASE WHEN @NumIntAut IS NOT NULL THEN (@NumIntAut) ELSE (SELECT NumIntAut FROM @. IN operator is used to checking a value within a set of values. Subquery returned more than 1 value. Subquery returned more than 1 value. " opening the following query:. A subquery must be complete query in itself - it requires SELECT and FROM clauses 2. This article examines one of the motivations for inventing LEFT OUTER join and including it in the SQL standard: improved performance through exclusion joins. Learn to resolve the error subquery returned more than 1 value. A non-scalar subquery returns 0, 1, or multiple rows, each of which may contain 1 or multiple columns. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. As everyone else, in my application when I set the report parameter “account_list” to one value it works perfectly, more than one, it fails. The expression is unknown (that is, NULL) if table t2 contains (0,NULL,1). Expand search. The parent query of a single. If there are more than one rows with the same category then try the below query,. "Subquery returned more than 1 value. if there were two meter readings on the same date. 0 can be redistributed from the SQL 2005 CD (it says so in the EULA) and it has gone through the full rigor of testing as part of the release on the SQL 2005 CD. Subquery returned more than 1 value. ORA-01427: single-row subquery returns more than one row!! How can it place two values into the v_mbr_id of this statement? To correct the issue, first diagnose what the problem is: Look at the statement that populates each of your variables for the statement that is failing. programming' started by Mary Phelps, Sep 2, 2010. Subqueries do not return duplicate records. If the subquery returns more than one row for a given row of T1, we must raise an error: Msg 512, Level 16, State 1, Line 1 Subquery returned more than 1 value. Tag: UPDATE statement: Subquery returned more than 1 value 13 Compare the value of a variable with previous variable from a function ,reset the counter when val changes I am in the middle of taking course 2073B 每 Programming a Microsoft SQL Server 2000 Database. "Subquery returned more than 1 value. A subquery that evaluates to a table with one or more rows, but is limited to only one column in its select list. " How i can fix this query to update 3 or more rows?. 推荐:SQL Server 2000中全文检索的使用. ORA-01427: single-row subquery returns more than one row. The content posted here is free for public and is the content of its poster. : Subquery « Subquery « SQL Server / T-SQL Tutorial. The ____ operator indicates that the records processed by the outer query must match one of the values returned by the subquery. The Transact-SQL language offers the ability to compare a column value to the result of another select statement. Subquery returned more than 1 value in MS SQL In MS Sql. I know that it has to do with the fact that I'm using a subquery to get the last name and first name of the supervisor, and I know that it has to do with the fact that there is more. There are never more than 3 matches (but there could be 0, 1, 2 or 3. the subquery is producing a scalar value but the. You can use a subquery field alias to display values that depend on other values in the current row, which is not possible without using a subquery. Teradata - Joins - Join is used to combine records from more than one table. Web resources about - Subquery returned more than 1 value - asp. Subquery returned more than 1 value. " When I run the query "SELECT COUNT(*) FROM tableName WHERE tablename. I converted the subquery to the following query to pull any value for the parameter (@ProductID) that will return more than one row. 3669 More than one value was returned by a subquery. Last Reply one year ago By dharmendr. c) b from t1 I need to write that kind of sql to return me single value a and multiple values b on each of lines, like. 3669: More than one value was returned by a subquery. type = type. Just want the column to have one of. When I run the stored procedure against the table in the targeted database, I get a ""subquery returned more than one value error"". Must be enclosed in parentheses to separate it from the outer/main query 4. Who are the department managers whose salaries are less than 550000 and whose budget amounts are greater than 950000? SELECT last_name,first_name FROM employee WHERE salary_amount< 550000 AND (SELECT manager_employee_number FROM department WHERE budget_amount. Elapsed time = 00:00:00. SQL executes innermost subquery first, then next level. A derived table is a transient table that is created dynamically from one or more tables by evaluating a query expression or table expression specified as a subquery within a SELECT statement. This kind of subqueries are also known as column subquery. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Therefore, if the following form is used, the subquery must return either no values (in which case the comparison evaluates to false), or it returns one value. SELECT @local_variable is typically used to return a single value into the variable. OREPLACE VS OTRANSLATE function in Teradata OTRANSLATE · Returns source_string with every occurrence of each character in from_string replaced with the corresponding character in to_string. In other words, as long as the SalesQuota value exceeds any one value returned by the subquery, that row is returned. Miksi saan laskulokilla virheilmoituksen "Subquery returned more than 1 value. A query that returns only one column value from the inner SELECT statement. user9093700 Nov 30, 2012 2:29 AM ( in response to Ashu_Neo ) HI ashu, actually the script was correct but i was not suppose to update one row but all the rows. I try this, but the SwitchCase can not return more than one value. For example, you might wish to know the maximum salary of all employees. Expected Lobs to be returned from Teradata. It then checks for one more matching rows in second table based on being used in the join using an index (primary or secondary) and returns the matching results. Rather than using >, which only makes sense when comparing to a single value, you can use > ANY or > ALL to compare a column value to a list results returned from sub query. A SELECT statement can be used for retrieving and joining column values from two or more tables into a. In SQL, the DISTINCT clause doesn't ignore NULL values. Using Multiple-Value Noncorrelated Subqueries. The statement has been terminated. A subquery that is used in an expression in the place of a literal value must return only a single row and a single column. more than one record returned with your criteria. For example, a query that spools out without a subquery that requires a sort operation might work if that sort operation is done separately in the volatile table build. 3669 More than one value was returned by a subquery. · S i ngle-row subquery · Multiple-row subquery · Multiple-column subquery. Without the proper correlation, this subquery returns more than 1 row. In this case you can think of the subquery as single value expression. user9093700 Nov 30, 2012 2:29 AM ( in response to Ashu_Neo ) HI ashu, actually the script was correct but i was not suppose to update one row but all the rows. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the values returned by the inner query is a null value, the entire query returns: Mark for Review (1) Points All rows that were selected by the inner query including the null values. IN operator is used to checking a value within a set of values. The expression is unknown (that is, NULL) if table t2 contains (0,NULL,1). A subquery can return no value, a single value, or a set of values, as follows: If a subquery returns no value, the query does not return any rows. SELECT MAX(salary) AS "Highest salary" FROM employees; In this SQL MAX function example, we've aliased the MAX(salary) field as "Highest salary". Msg 512, Level 16, State 1, Line 3 Subquery returned more than 1 value. Close search Cancel. If you introduce a subquery with all and a comparison operator does not return any values, the entire query fails. The subquery can return at most one value. A scalar subquery expression is a subquery that returns exactly one column value from one row. Subquery returned more than 1 value. The outer query retrieves all rows from the PRODUCT table that have a lower list price than the average list price. A flat distribution means there is the same quantity values exist for each number. Re: Subquery returned more than 1 value. Explanation: If a subquery is used in a unquantified predicate, the subquery must return either no values or one value. Msg 512, Level 16, State 1, Procedure trig_NotificationProduct, Line 19 Subquery returned more than 1 value. If the SELECT statement returns more than one value, the variable is assigned the last value that is returned. 5319=====The specified DATABLOCKSIZE value is invalid 5321=====Constraint, primary index, or secondary index with the same name '%VSTR' already exists in table. This kind of subqueries are also known as column subquery. I need to use the Script fields. +++ Message: Subquery returned more than 1 value. IN operator is used to checking a value within a set of values. It actually doesn't matter what the subquery returns, as long as rows are returned. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Subquery returned more than 1 value. See the following customers and orders tables:. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. This is especially true when the value for comparison is based on an aggregate. Try adding a row in our table ‘student’ with ID as 6, name as ‘dan’ and age as 24. The subquery can return at most one value. A scalar subquery expression is a subquery that returns exactly one column value from one row. When I ran the SELECT query on its own it returned 163. WITH TIES returns multiple tied rows when there is a tie for the 'last' position. There can be more than one subquery returning information to the outer query. This problem occurs if the following conditions are true:. The subquery's result is a single value- the average salary. When I try to log in or register a user I get the following error: Subquery returned more than 1 value. The number of columns that the SET clause explicitly or implicitly specifies must equal the number of values returned by the expression (or expression list) that follows the equal ( = ) sign in the multiple-column SET clause. Example 1: Single-row subquery. subquery returning multiple values in sql server is query result when i used where in() claues. Please see the query below. 44 Release Notes - September 30, 2019. Id) FROM [Order] O WHERE O. I converted the subquery to the following query to pull any value for the parameter (@ProductID) that will return more than one row. If more than one subquery is used in a query-expression, the innermost query is evaluated first, then the next innermost query, and so on, moving outward. That's what's being complained about. Subquery or Inner query or Nested query is a query in a query. You can ensure that a subquery will always return a single row. ) If the subquery returns no rows, the outer join simply returns NULL for T3. SQLServerException: Subquery returned more than 1 value. One of the values returned by the inner query is a null value and hence the entire query returns no rows. A join is a technique for accessing data from more than one table in a single answer set. Types of Subqueries. We will use our student table where each student mark is stored in a field. The Teradata database checks the WHEN conditions starting from the first one if it matches the selector value. Please post your comments and questions as a separate thread. The statement has been terminated. Teradata - SubQueries. If you post the necessary scripts (create table and inserts with sample data) and explain with enough details the result you want to achieve, we can help you. Your subquery involves a UNION of two queries, which is almost guaranteed to return more than one row. This is a quick reference to using date and time on Teradata. Generated By: OPT modules. A flat distribution means there is the same quantity values exist for each number. 3669: More than one value was returned by a subquery. single-row subquery returns. TB_DIM_FUNCIONARIO INNER JOIN P_ISIDB. Any help and advice would be greatly appreciated. So you might even find that the inner join and the correlated sub-query can at times have the same plan and. Web resources about - Subquery returned more than 1 value - asp. Single row subquery : Returns zero or one row. The expression list can include one or more subqueries. Subquery returned more than 1 value. The subquery returns a single value: the average list price in the PRODUCT table. It is an excellent technique to use when there is a need to determine which rows to SELECT based on one or more values from another table. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the values returned by the inner query is a null value, the entire query returns: Mark for Review (1) Points All rows that were selected by the inner query including the null values. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. type = type. Muliple-row subqueries: Querıes that return more than one rows from the inner SELECT statement. "Subquery returned more than 1 value. A subquery is usually added in the WHERE Clause of the sql statement. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Explanation: If a subquery is used in a unquantified predicate, the subquery must return either no values or one value. Elapsed time = 00:00:00. You need to check your logic. Nested Join works on UPI/USI used in Join statement and is used to retrieve the single row from first table. Correlated Subqueries A SELECT statement used as either a scalar subquery or as the right-hand operand of an IN, NOT IN or EXISTS expression may contain references to columns in the outer query. The advantage of the latter is that repeated references to the subquery may be more efficient as the data is easily retrieved from the temporary table, rather than being requeried by each reference. Than you specify a number of values that the selector value should be matched against using the WHEN clause. Web resources about - Subquery returned more than 1 value - asp. The provider does detect a sub-query is to be created under most scenarios. type = type. "TOAD, Teradata, Pulling Records With More Than One Value Returned by a Subquery" Hi all. If no condition is matched then TERADATA SQL CASE will result in output specified in ELSE clause. This is not permitted when the subquery follows =, !=, = or when the subquery is used as an expression. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used SAP Knowledge Base Article - Preview 1372928 - BPC: Error: "Subquery returned more than 1 value. Subqueries with any and all. " When I run the query "SELECT COUNT(*) FROM tableName WHERE tablename. This is not permitted when the subquery follows =, !=, <, <=, >, >= or when the subquery is used as an expression. A subquery, or inner query, is a query-expression that is nested as part of another query-expression. MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux. However, if you run more than one Teradata server, you must use the TDPID= option to specifying a dbcname of eight characters or less. If you specify multiple columns in the update_set_clause, then the subquery must return as many values as you have specified columns. Using subquery to return one ore more rows of values (known as row subquery) 5. Upon running a T-SQL select statement that I just now composed, I'm getting the following error: "Subquery returned more than 1 value. You can, of course, return more than one record. If you have a sub-query as y, it must return no more than one row. Subquery returned more than 1 value. SqlConnection. subquery returning multiple values in sql server is query result when i used where in() claues. The AMP holding the right table rows returns them to the initiating AMP. If you specify only one column in the update_set_clause, then the subquery can return only one value. Any help and advice would be greatly appreciated. The problem starts from the SELECT @DISCONTIUNED = (SELECT Discontinued FROM inserted) in my trigger. Multiple-row subqueries are subqueries used with an IN, ANY, or ALL clause. Subquery or Inner query or Nested query is a query in a query. If more than one row of data is returned, then Teradata Database assigns these values to the status parameters:. This thread is locked for new responses. "Subquery returned more than 1 value. Using the EXISTS and NOT EXISTS operators : Subquery Basics « Subquery « Oracle PL / SQL Larger than value from subquery: 26. SQL Subquery Examples Problem: List all customers with their total number of orders SELECT FirstName, LastName, OrderCount = (SELECT COUNT(O. We are entities that have a relationship called "authorship"; you should have an "Enrollment" or "Class_Roster" relationship. 1 Roselin 10000. Tag: UPDATE statement: Subquery returned more than 1 value 13 Compare the value of a variable with previous variable from a function ,reset the counter when val changes I am in the middle of taking course 2073B 每 Programming a Microsoft SQL Server 2000 Database. " I need to understand why in my case. Remember that you must include the columns that are before the count in GROUP BY: SELECT <column>, COUNT(<column>). > any means greater than at least one value, or greater than the minimum value. 3669 More than one value was returned by a subquery. " But the point of the subquery was to in fact return more than one value. Teradata SQL CASE expression is used to check for various conditions sequentially and produce result depending on which condition is met first. 0000 2 Robert 20000. Subquery returned more than 1 value. It will return the number of rows in a group. Just what single value do you want this subquery to return? Bill Koster CSC/DECC.