Seems this is a popular topic but I can’t seem to replicate other answers. I have data that is already summarized by month/year for multiple categories. What I’m trying to get is this Here’s the query to provide the data I’ve used PIVOT a bunch of times, but with a single “category” of data. I can’t seem to get anything
Tag: tsql
Write a SQL query to calculate the balance in a card [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Can you please help me how to calculate the balance for each quarter The data table Script to create the table: Create Table CardTransactions (
Sql join only 1 row
I want to join the table CustomerAgreementRole with only one row from AgreementRoleGroup, based on ViewPriority. Example: CustomerAgreementRole can have three rows. I only want the joined row where ViewPriority is highest Current query: Expected result: Answer Made it working with this:
TSQL Two different tables, 800GB vs 2GB Find common
I have two tables, generatedblock table, and addresses table The generatedblock table has a column called expandedblock block. The addresses table has a column called address. What I need to do is find if in the generatedblock table there is a value in the addresses table. I have tried failed code but I am not reposting because my tsql sucks,
Select within grouped query to return last record of that group
I have a table which stores events along with event type and booking ID’s, my goal is to group the BookingID and return the first EventDate, the last EventDate and the last BC_EventType | ID | …
SQL Join that finds non matches
I have two tables “SellerDetails” and “ANL” and both have key fields of “Seller Ref No” and “Sales Year”. This giving me where there is a match on Seller Ref …
Numbering sequences from xml according element’s values
The PointNum attribute means the number of coordinates in the chain. The coordinate chain starts at 1 and ends at 1 as well (inside each Parcel element). However, within the sequences of these points, …
Dynamic SQL :: Calculate percentage of NULLs per index
I have a query that help me list all index in a database and works pretty well: Unfortunately if I uncomment the 6th line the word t.name is underlined in red and if I run the query I receive the error: How can I make this subquery work? The goal is to have a percentage of NULLs on each column
TSQL – Select Latest Date by 2 Type
I need select data in SQL Server. I have a Data example like this DECLARE @tblA TABLE (ID int, SubId int, Createdate DateTime) INSERT INTO @tblA VALUES (1, 1, ’10/21/2020′) , …
Join fom two source tables into a single column
How would I accomplish this? I’m lost on how to accomplish this. I have a table with relationships to a like named field in two different tables. I’m trying to join them such that the two columns get …