Skip to content

Tag: sql-server

How do I get two different counts from a table in select query

I am trying to have my select query pull the count of items that exist in both tables in one column, and the count of the items that only exist in one table. These two queries give me the data I need, but would like it come from one query. Thanks in advance. Desired Result: Answer You can combine a

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…