Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year. Improve this question I have a stored procedure with a cursor inside for the logic which is taking…
Need to match a field with another that has commas on it’ s value
I would like to match the field values of “FORMULATION” from TABLE 1 to “C_TEST_ARTICLE” from table 2, that has mutiple of these formulation sepparated by commas. Table 1: +——–…
SQL – Delete random rows where sum is equal to given number
I want to get some random rows from the given table where the sum is 250(this can be changed). I don`t need to 100% accurate but can be approximate. Like for 250 (1,5,7) Note:- My table has huge data. Answer For any specific numbers, you can return the closest sum using logic with joins. For instance for 3 nu…
Insert row with uniqueidentifier
This is a snippet from a stored proc that creates a database. We have a table with uniqueidentifier PK. I’m trying to insert a row with an empty guid as the PK: The error messages are Can’t see what’s wrong with the VALUES clause but I guess it has something to do with the final quote, altho…
Arithmetic overflow error converting nvarchar to data type numeric in case query
I am trying to show the number of quotes won as a percentage of the total number of quotes in a time frame. For example. I have a total of 294 quotes and 173 of them are won. The result I am looking …
All categories for each week and group
Hi I have a data source as such Data: Weeknum Group Priority Total 202106 A High 10 202106 B Medium 15 202107 A Medium 88 Priorities: Priority High Medium Low The data has already been grouped such that each weeknum+group+priority is unique. What I need to do is return the full list of priorities for each wee…
How to add counter id column based on several columns on SELECT query Postgresql
I would like to create a column with counter number based on question_id and matrix_question_id this is my query: and this is the result I would like to create a new column as id_counter represent id counter base on question_id and matrix_question_id and I wish the result like this Answer What you need here i…
Django complex partitioning & ordering for tree Table
I’m using Django with PostgreSQL as my Backend-Stack for an application of which the main feature is a complex, multilevel table displaying annotated time-series-data for different products. So …
Find rows that have characters other than a plus (+) sign or number in a phone field
I want to find all rows in a phone column that have any character other than a plus sign (+) or numeric digit. It can be any character like slash, space, bracket, alphabet or any other character. The column has phone numbers, but may rows has space, brackets and slashes. I want to see those. Like: But theses …
Oracle SQL Pivot with Conditions convert rows to columns
I have the a table ITEM_SF with the following data I want to convert the data into Columns with a few conditions: My desired result is to show Charges, Discounts , Amount Paid and Tax Charges include (BookFees, HealthFees,RegistrationFees,SSCFees,TuitionFees,GeneralFees) Charges , Discount is Sum of ITEM_AMT …