SQL Server :: ERROR: Subquery Returned More Than 1 Value. This Is Not Permitted When The Subquery Follows =, !=?
Feb 16, 2011
im doing an update in web page by pressing a button. At the start some of the update was from a trigger, but i decided to put the hole update statement in the web page as an updatecommand in VB. this is the error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.The statement has been terminated.and this is the code.
the error is in the updatecommand. And i dont know what is it.
I have been trying to create a sql statement that uses a subquery to join 2 oracle tables to create a strongly typed table adapter. For example:
Select productName, (select categoryName from categories where categories.category_id = products.category_id) as Category from Products
The ASP .Net tutorial I am working through recommends using subqueries instead of joins for the insert, update and delete commands to be automatically generated by Visual Studio 2010. When I click Finish in the table adapter wizard I get the following error (I am using MySQL version 5.1 and the MySQL Data Connector 6.3.5)
Generated SELECT statement. Error in SELECT clause: expression near 'SELECT'. Error in SELECT clause: expression near 'FROM'. Missing FROM clause. Error in SELECT clause: expression near','. Unable to parse query text.
* 100 AS PERCENTAGE FROM support.SRFILE INNER JOIN BSFLBWF AS BSFLBWF_1 ON BSFLBWF_1.Incidentx = SRFILE.SRONUMBER WHERE (BSFLBWF_1.Closex IS NULL) AND (BSFLBWF_1.DedTypex = 'School' OR BSFLBWF_1.DedTypex = 'LAN-MLE') UNION ALL
The rest of the query continues as the above albeit selecting the same data from different tables and works fine.
The issue I have is that I want to Select some more data (another SELECT query) but with a different Where clause e.g. WHERE (BSFLBWF_1.KPIx NOT LIKE 'KPI%' OR BSFLBWF_1.KPIx NOT LIKE 'Proactive%') AND (BSFLBWF_1.Availabilityx LIKE '')
The problem is that this WHERE clause returns data which the above in bold has null values for (and thus doesnt work). Im still selecting the same data its just the WHERE Clause has changed. Is it possible to run such a query? If so, can it be done via a sub query?
I need to write a query (SQL Server) which gives me data according to the tags say if I want bookIds where tagid =9 it should return bookid 113421 and 113422 as it exists in both the books, but If I ask data for tags 9 and 10 it should return only book 113421 as that is the only book where both the tags are present.
I have a SELECT query which grabs data from two different tables however when I run the query the CurrentCallOwner often pulls up the same name twice albeit with a different SLAFailed value. What I am trying to do is bind those two values into one. I thought that running a subquery and using a count would solve this however I all receive are a bunch ones. Do you know how I could bind those values into a single value (i.e. add them up?)
SELECT CurrentCallOwnerx, SLAFailed, COUNT(CurrentCallOwnerx) AS Expr1 FROM (SELECT BSFLBWF_1.CurrentCallOwnerx, COUNT(BSFLBWF_1.Incidentx) AS SLAFailed FROM .SRFILE INNER JOIN BSFLBWF AS BSFLBWF_1 ON BSFLBWF_1.Incidentx = SRFILE.SRONUMBER WHERE (SRFILE.SR_GROUP = '38') AND (BSFLBWF_1.KPIFailx = '1') OR (BSFLBWF_1.SchoolChargex > '0.00') OR (BSFLBWF_1.LANMLEChargex > '0.00') GROUP BY BSFLBWF_1.CurrentCallOwnerx UNION SELECT BSFWES_1.CurrentCallOwnerx, COUNT(BSFWES_1.Incidentx) AS SLAFailed FROM SRFILE AS SRFILE_1 INNER JOIN BSFWES AS BSFWES_1 ON BSFWES_1.Incidentx = SRFILE_1.SRONUMBER WHERE (SRFILE_1.SR_GROUP = '38') AND (BSFWES_1.KPIFailx = '1') OR (BSFWES_1.SchoolChargex > '0.00') OR (BSFWES_1.LANMLEChargex > '0.00') GROUP BY BSFWES_1.CurrentCallOwnerx) AS derivedtbl_1 GROUP BY CurrentCallOwnerx, SLAFailed
I have a table line (ID, LineNo, LineName) having values as :
1, 1, <blank> 2, 2, <blank> 3, 3, <blank>
ID is PK with Auto-Increment and LinNo(I am manually incrementing through ASP.Net Page while record insertion) Now i have to write a query such that it updates LineName column from line table which is blank(as shown above) with values from table linet(linenamet) having values as :
a b c
My trial query is : update line set LineName = (select linenamet from linet);
It gives ERROR as : Subquery returns more than 1 row Expected Result : After Updation it should show line table as : 1, 1, a 2, 2, b 3, 3, c
I'm working on an ecommerce project that is missing 5,000 product pictures.
I am trying to assign all products without pictures into a category located on a mapping table.
I know an insert can be accomplished from one table (or subquery) to another but I only need to find the product IDs and insert them with default values into the category mapping table that has all non-null columns.
The following code is the farthest I can get without help (I'm not strong in SQL), it won't work because my subquery returns many rows while the SQL statement is designed to insert one - I don't know how to handle this...
Any help would be appreciated from those more experienced than I. BTW... there are no known search results for this type of solution - if there is even a solution.
Public Function ProductList() As System.Linq.IQueryable(Of Northwind.Products)
Now I want 2 Subquery from of above results . I want to save ProductList to DataTable or ... so that I only Connect to DB One and then Use Below subqueries from Sub1: Takes 1 record from "ProductList" results.Sub1: Skip 1 record and take 10 records from "ProductList" results.
I have the following SQL Stored to get all online valid articles in my ASP.NET news application:
I'm trying to check if the article checked as never expire when added to the data base and if not checked I need to check if today is between article start and end date.The statement worked but only when added the first article but when there are more than one article it returns with the following error :Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
why I'm getting this error? I just re-created (not migrated) my app that was in ASP.NET 1.1 to ASP.NET 2.0. Whole app works perfectly. The only problem I'm getting with this piece of code for the Web Services. I'm running both versions at the same time side-by-side and it works fine in 1.1 and doesn't work in 2.0.
URLName = Context.Request.Url.Segments URLName0 = URLName(0) URLName1 = URLName(1) URLName2 = URLName(2) URLHost = Request.UserHostName URLStr = "http://" & URLHost & URLName0 & URLName1 & "SomePage.aspx?" & "SectionID=" & SectionID ' Create a 'WebRequest' object with the specified url Dim myWebRequest As WebRequest = CType(WebRequest.Create(URLStr), WebRequest) ' Send the 'WebRequest' and wait for response. Dim myWebResponse As WebResponse = CType(myWebRequest.GetResponse(), WebResponse)
Bam! Error! The remote server returned an error: (500) Internal Server Error.
In IIS we have a virtual directory (named as "Documents") with in application virtual directory (named as "Reference") that points to an shared folder.All the files with in the "Documents" folder are listed and opened by the user (by clicking on the file name) with in the application
"Reference" application runs under an application pool. This application pool is configured to run with an Active directory account. This AD account has been granted write and modify permissions on the shared folder that contains the html files.
When user tries to open any of the html file located with in the shared location from the application following error is thrown.
System.Net.WebException: The remote server returned an error: (500) Internal Server Error
I tried to browse to the location manually and I can see the required files there.
These files where accessible from our application until yesterday. But we started encountering this error from today.
Is there any IIS settings that needs to be modified?
I am running this piece of code to get the source code (as string) of my webpage.
The problem is why this function returns 404 error?
Private Function getPageSource(ByVal URL As String) As String Dim webClient As New System.Net.WebClient() Dim strSource As String = webClient.DownloadString(URL) webClient.Dispose() Return strSource End Function