I have a data set in which I need to concat month and year for the previous month. the problem is it spans over two years. I need to create a statement in which mean the month – 1 = 0, month becomes …
Tag: sql
How to pivot time series table without aggregation
I am pulling sensor data from a Teradata table for analysis. Below is what the table looks like. I want to pivot it such that sensor names become columns. There are more than a hundred sensors and …
Sql query to flter by column only if duplicate exists
I’m writing a query on data with a ‘provider_id’ column. The data is mostly unique except for some entries with all columns but ‘provider_id’ being unique. Most of the values for provider_id are 1 but …
can you set environmental variable to round numbers in SQL Server query?
I have a bunch of calculations in a SQL Server 2012 query, kind of like: select T1_month ,a.some_value, b.value_to_compare,(select (some_value – value_to_compare)/value_to_compare*100 where …
VBA SQL update/insert to local table using values from form
I am trying to update a row in a local table stored in access (or insert a new row if that ID doesn’t already exist) using values populated in a form by the user. I am writing it in VBA using SQL. …
Count distinct values in ColumnA for each unique value in ColumnB
I have a table of shipment numbers (can be duplicate) and a concatenated field of their origin – destination (can be duplicate). I have a select column that selects all of the origin-destinations for …
How to display the name of a supervisor for a certain worker MYSQL
Display the name of McLester’s supervisor. Using standard syntax select sup.lastname “Supervisor’s Name” from staff e, staff sup where e.supervisorno = sup.staffno and lastname = ‘McLester’; Here is …
NULL behavior with Comoperator like ALL in Oracle SQL
https://oracle-base.com/articles/misc/all-any-some-comparison-conditions-in-sql Query 1 : Nothing is coming. But for below quesry. All records are coming while subquesry is returning is NULL same as like above query (SELECT NULL FROM DUAL ) Query 2: Please explain me why Query 1 is returning No Records but Qu…
Capturing year of a DATE in SQL Worksheet (Datameer)
In Datameer, how do you capture the year of a DATE column in a SQL worksheet? This query SELECT YEAR(rslt_part.draw_date) AS YEAR, COUNT(*) AS CT FROM rslt_part GROUP BY YEAR is returning the …
SQL query assigment
1) Query that returns all agents who had sales greater or equal than 20 in month March, also sum of sales in month March greater or equal than 20 and number of sales in month March greater or equal …