Skip to content

Tag: sql

Oracle complex query with hierarchy

Following is my Sample data1 Expected Output1 Here column “CP” and “NNP” are hierarchical (i.e.) we will start with query like below, for a particular NP and then get the corresponding MC and DS values using the below logic first look at value A from column CP and then see if column NN…

Percentage in SQL Server

I want to find the percentage between two columns and I tried this : select (count(id)* 100.0 /(select count(id) FROM db.table where log = ’40’)) as percentage from db.table; And the result is this: …

How to split data in SQL

I have the following code: Used Table names: WIPtransaction, WIPtransactiontype, Feeearner I want to display two more columns at the end of the output, namely: Invoiced and Uninvoiced. The “Invoicenumber” field in the “WIPtransaction” database will be tested for this. If the “Inv…

How do I convert this SQL into LINQ?

How Do I convert this sql query: select * from Trades where tradestatus = 1 and tradetype = 1 and maturitydate < GETDATE() and referenceId not in (select referenceid from Trades where tradetype = 2)…