I have written the following select: What I want to do: I want to delete the rows in reminder, which are fetched by the described select. What I tried: Result: 00907. 00000 – “missing right parenthesis” I wonder if i can basically delete these rows in this manner. I also tried ‘exists&…
Tag: sql
How to remove “not a GROUP BY expression” error from the statement?
The schema of the table is: Emp (Empno, Ename, Job, Mgr, Hiredate, Sal, Comm, Deptno) Question: Display the job, deptno and average salary of employees belonging to department 10 or 20 and their salary is more than 2000 and average salary is more than 2500. My Query: Error: ORA-00979: not a GROUP BY expressio…
Grouping the common values in Oracle
I have a table with sample values as below In this table, all the values in Col1 will have its supporting values in Col2. The values A1 and A2 are like master values and they will never appear in Col2. I need to make an output displaying this master values in a new column like below What would be the
Scope_identity is giving null values? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I have stored procedure in which I use scope_identity() Error I get: cannot insert null into i…
Build a report with SQL with combining columns and rows?
Here is my table: Table Purchase Report PURC_ID CUS_ID Product QTY Date 1 John Leg_01 2 2021-04-09 2 John Head_01 1 2021-04-09 3 Dawn Head_01 1 2021-04-09 4 Dawn Shoulder_01 2 2021-04-09 5 Dawn Leg_01 1 2021-04-09 6 Keith Leg_01 2 2021-04-09 I would like to build the report as follow: Table 4: (PURC table wil…
How do I construct my WHERE clause to pull records based on this specific criteria?
I am using SQL Server 2014 and I have a T-SQL query running against a specific Table (t1). Table t1 includes 3 columns named [HR_LeftDate], [Payroll_LeftDate] and [Status]. In that table, there are records which have their [HR_LeftDate] and [Payroll_LeftDate] as ‘NULL’ and some other records which…
problem with constraint order in create table in livesql
This gives error: This doesn’t: Why? Answer Each DBMS defined it’s syntax to write SQL. It only works if you obey their rules. It’s kind of obeying the law of a country while you are in it. You can’t ask why I should do that? You have to. Or choose any dbms you like. If your dbms tells…
Oracle sql pivoting values separated by commas
I have the below input ID LOTYP PROID LOCKR XXXXX 06 01 Y XXXXX 06 02 X XXXXX 06 02 S XXXXX 06 01 R XXXXX 02 01 Y XXXXX 02 02 X XXXXX 02 02 S XXXXX 02 01 R YYYYY 06 01 Y YYYYY 06 02 X YYYYY 06 02 S YYYYY 06 01 R YYYYY 02 01
How to select Maximum and minimum date values and pass those as a query
I have a table with the following entries CustomeID TransDate WorkID 1 2012-12-01 12 1 2012-12-03 45 1 2013-01-21 3 2 2012-12-23 11 3 2013-01-04 13 3 2013-12-24 16 4 2014-01-02 2 I am trying get the data between two dates and the required date values are minimum and maximum values of the column. I am able to …
How to replace identical values with incremental integers?
I have this SQL select: The output will look something like this: How can I replace the identical values of UserId with incremental integers, so that the output will look something like this: I have tried grouping the identical UserId rows first then joining it with the same table while having an incremental …