Skip to content
Advertisement

Tag: sql-server

Calculate conversion rate with the specified conditions

Here is my sample data table: ID Status 1 New 1 Processed 2 New 2 Processed 3 New 3 Processed 4 Processed 5 New What I am trying to solve here is calculate the conversion rate from Status ‘New’ to Status ‘Processed’. From the dataset, only ID no.1,2 and 3 fulfilled the requirements of my problem, and ID no.4 and

Get MIN value between 3 columns on same row

Though I have come up with a couple of working solutions to what I am looking for, I am wondering if there is a more streamlined way of determining which of 3 columns from a single row contains the smallest/min value. Below is an example of the data I am working with: AccountNumber Job DaysSinceLastSale DaysSinceLastCharge DaysSinceEstablished YO502 NULL NULL

Can’t connect Sqlalchemy with pyodbc to SQL Server 2000

I followed this website by installing After install I try this code and it worked, it print all records from table2 However, I want to use SQLAlchemy with pyodbc and it does not work ProgrammingError: (pyodbc.ProgrammingError) (‘42000′, “[42000] [FreeTDS][SQL Server]’schema_name’ is not a recognized function name. (195) (SQLExecDirectW)”) [SQL: SELECT schema_name()] (Background on this error at: https://sqlalche.me/e/14/f405) How can I

How to group data by past few weeks?

I have an original table like this, Can I group my data using GROUP BY in SQL to get the aggregate value by each week? My expected output will be like, Answer This is a way of doing it, probably not the best way however. Personally, I feel like this list is not something you’d want to do in SSMS.

Find ID which doesn’t exist from another table

I am studying SQL and I am not sure which is the way to filtering data. For example, there I have two tables: Reference_OrderTable: OrderID Item Price OrderTable: OrderID Item Price Reference_Ordertable: this table has all the type of orders. OrderTable: this is the actual order table, we store by customer’s orders. I am looking for missing orderID in OrderTable.

BCP queryout hangs with READ COMMITTED transaction isolation

Using SQL Server 2016 and bcp version 14 My query returns about 16k rows and runs quickly to completion in SSMS with the default (READ COMMITTED) isolation level however if I try to save the output of the same query using BCP the tool hangs. If I set isolation level to READ UNCOMMITTED in the BCP query then it completes

How to use group by with case statement [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 8 months ago. Improve this question I have a table with following fields CREATE TABLE Tblstock ( ID int

Advertisement