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 I’d like to create a report that has columns like Year, Month, Earnings. From Month Jan. to Sept, the report
Tag: tsql
Query to update duplicates
I have the following query that returns duplicates that i am running on sql server. So I need to write a query that will update second instance of the email address based on the select query that retrieves dulicates to for example imports@rohnis.com to imports@rohnis.com.duplicate. If it is info@eps.ws then info@eps.ws.duplicate. So basically postfix the email address with the word
Extract substring address SQL
I have a table with column Address which is like city. City_Name, citysector. CitySector, Street. Street_Name, StreetNumber. Street_Number EXAMPLE Address c. Paris, s. ParisDowntown, str. Rue Étienne Marcel, nr. 50 How can I substract 4 different columns like city, sector, street, streetNumber from Address column? Thanks in advance! Answer With a couple of replaces you can change your string format
Need to Update Offdate of Component Only Where it’s Used Alongside Another Component
I need to update the offdate of a component (322058-000000′) of a parent part where the component in questions is used along with another component. The following code gives me the component (322058-000000) and the instance where it needs to be changed. It needs to be changed where it is used along with component (322123-301200). I only want to update
Get the rows of my output sorted in ascending order from this table?
I am using SQL Server 2014 and I have the following table (t1) which contains around 5,000 rows. Here is an extract of t1: n1 n2 n3 n4 n5 n6 Type 6 15 10 11 22 25 C1 2 …
How to get how many hour 4AM have there been between two dates in TSQL
I need to get how many of a specific hour have occurred between two dates in TSQL. Some examples: The following would give the result = 1 declare @date1 datetime = ‘2019-10-01 00:00:00.000’; declare …
Find start date and end date from the employee time clock
I am trying to find out star date and end date for the employee time clock. Following is the example of the data I have. Output wanted: I have to find the start date and end date of the person based on eventtime and activitycode. The start date will be event time column and I have to calculate end date
SQL change a table into another format
I have a table like this: Faculty Program Number_of_enrolled Science Financial Modelling 25 Science Actuarial Science 30 Science Statistics 28 Science Biology …
SQL Server: table join based on record-dependent values
There’s a general type of query I’m trying to perform, and I’m not sure how to express it in words so that I can find a discussion of best practices and examples for executing it. Here’s an example …
Query to generate map table to matrix table
I have 1 map table Group Task —– —– Admin Add Admin Edit Admin Delete Admin View User View I need to generate it in a matrix table like Task Admin User —— —— —— Add …