I want to select data from the SQL table and fetch data from the table with the use of LIKE and BETWEEN clause together and I have tried below query. but it shows me the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
Tag: sql
Need to create a Totals report from oracle table data
I have a table in oracle similar to the the example table image that I need to have output the segregated totals as shown in the second example results image. I need the sums of each item_type where A & B are just examples for a large number of possible items that can be added. example table: example resu…
Weird behavior with MySQL GroupBy on multiple columns
I am writing a query that groups a table of users by (height, sex) and then gets the name of the user with the minimum weight for that combination of height and sex. If you wanna skip to the actual query, here is the SQLFiddle with a minimal representative example. If you don’t want to open that url, he…
How to print the cursor values in oracle?
I am new to oracle and I am learning cursors.My table City has two columns city_id,city_name.So,this is what I tried: i am trying to assign the data of cursor to the newly declared value v_list SYS_REFCURSOR;.But the output is coming as error at v_list := city_list;.How can I assign all the values of cursors …
How to group records by hours considering start date and end date
I’m trying to group records by hours with consideration of duration. Assume there are long running processes and there is log data when process has been started and finished. I’m trying to get report by hours how many processes were running The data looks like this Process_name Start End ‘A&…
Invalid object name of stored procedure error
I have a stored procedure such as below : when I execute this procedure, I get an error: Invalid object name ‘dbo.sp_InsertPumpsStatus’ What is problem? Answer In your script, It can be clearly seen that, You are giving same name to the stored procedure as the table in statement. Make sure the def…
TypeError: Params must be in a list, tuple, or Row in Python
I built out a python script the retrieves data from Auth0 and publish it to Ms-sql but im getting errors When I did the print statements, everything printed great. but when i used SQL commands to try to populate my table, it returns this error Any suggestions/insights appreciated! Answer executemany executes …
SQL Exist in either TableA or TableB
I am attempting to create a script which needs a clause to check of a column value in Table 3 exists in Table 1 or Table 2 Msg 4145, Level 15, State 1, Line 44 An expression of non-boolean type specified in a context where a condition is expected, near ‘)’. Answer Problems with your query: Missing…
RedShift Error when using COUNT (Distinct XXX) ERROR: XX000: This type of correlated subquery pattern is not supported due to internal error
I have a small query running in RedShift through Aginity that is getting the following error: ERROR: XX000: This type of correlated subquery pattern is not supported due to internal error Current …
Is there a way to add variable value for new column in Alter Table statement?
DECLARE @VName VARCHAR(8) SET @VNAme = ( SELECT TOP 1 xyz FROM table WHERE abc = something ) …