I’m having the data in data base like in the below. Emp_id Ename Sal 11 AAA 10 22 BBB 20 33 CCC 30 44 DDD 60 Then i want to populate a new column as in the below. …
SQL query to select previous 14 months where add amount ‘0’ if any month is missing
I have create this query to select the date, amount for previous 14 months, In this case the month is missing if no record is present for that month, Please suggest me a solution to add zero and month …
How to Select Max Numeric from Varchar Field in MYSQL
select userid from user; +——–+ | userid | +——–+ | .1. | | .1.1. | | .2. | | .3. | | .3.1. | | .3.1.1 | +——–+ Here I want to select the maximum number (which is 3) from the …
SQL oracle: How can I get the results of 4 selects statements added & subtracted to get one value with a ‘WITH’ keyword
My code is: The result of each select statement in the with clause returns one value. I am trying to add the expenses and subtract it from the income. When I run the whole code I am getting some error which I am unable to figure out. Am I doing something wrong? I want the result from the aliases in
How to run a query for current date for date partitioned tables?
I have a table that is partitioned by date so something like ‘tablename_20191205’. Is there a way for me to run the query everyday without having to modify the date? Also how would I do this if I am using two tables. So instead of typing, Select * From ‘tablename_20191205’as table1 and…
Sort a VARCHAR column in SQL Server that contains numbers?
I have a column in which data has letters with numbers. For example: When sorting this data, it is not sorted correctly, how can I fix this? I made a request but it doesn’t sort correctly. Answer This should work
Fraction formatting as halves or one third or quarters in PostgreSQL
I have some double-precision values in a column in PostgreSQL as following: I want to round these values to their nearest quarter value at the decimal place. That is: I saw this kind of feature in MS Excel. It can be found at: How can I do the same in PostgreSQL? Thanks in advance for your help. Answer You ca…
Optimizing subquery in sql [closed]
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 2 years ago. Improve this question Given the following SQL query Recently this query has been taking longer t…
Joining two different tables with a common third table on a common column
Here are the tables Table: Status ID, StatusDesc 1, New 2, Active 3, Cancelled 4, Complete Table: Order (foreign key relationship with Status table above) ID, OrderNumber, StatusID 1, 1001 , …
PL/SQL: Function returned without value
I wrote below FUNCTION to check given data is exist. It is working before but when i add new data on table named iqa_department it suddenly after triggering the function returns me with that error, im kinda new in oracle fom mysql to oracle Here’s how i call it. error i’m getting Answer try this: