avoid a sub query to get a maximum number
I wrote the below query which I am trying to get the maximum transaction number of a code and status, is there a way I can re write avoiding the sub select ?
avoid a sub query to get a maximum number
I wrote the below query which I am trying to get the maximum transaction number of a code and status, is there a way I can re write avoiding the sub select ?
avoid a sub query to get a maximum number
I wrote the below query which I am trying to get the maximum transaction number of a code and status, is there a way I can re write avoiding the sub select ?
invisible trailing spaces in SQL Server column , RTRIM doesn’t work completely
Can you help to understand why I can not remove trailing spaces (at least how I can see them) from my city column, sorry can’t do true replication code, after paste copy it’s not reproducible. So pasting result from my original source.
is there any possible simplification of the SQL PIVOT operator?
The pivot operator is a common requirement for querying data, but requires a cumbersome syntax that I always have to look up and usually find it easier just to copy from SSMS and paste into Excel to get a quick answer, so I have never bothered to memorize the syntax. I’m not new to this; I have worked around this for decades, but wanted to ask community if there was something I missed…
SQL How do I aggregate across multiple columns where any match?
SQL Server 2012, everything needs to be a SELECT statement with no procedures (platform limitations).
Trying to delete 2 id table using union
I am trying to perform a delete on a table that has 2 id’s with the differences of a view that I am using 2 ids on as well. Here is how I am finding the differences in Id’s:
Union of differences. Let’s say I have one table named Worker with columns WorkerId and ShiftId
Table1 data:
How to update multiple records with the same values but using different values in the where clause [duplicate]
This question already has answers here: Update statement to update multiple rows (4 answers) SQL update query using joins (13 answers) Closed 2 days ago. I have to update a large number of rows with the same values, but the values in the update where statement would be different for each row that needs to […]
I am trying to insert randomly generated numbers into an empty table using a cursor
I am trying to insert randomly generated numbers into an empty table using a cursor but I want it to go through all possible combinations with out having duplicates of the same number and I want to add conditions to what needs to be inserted. I want it to run through the code multiple times, I don’t want to have to execute it to the whole time to get like 1 million rows.
Calculate days in between status change
I’m not sure how to code to get the result I’m looking for. I hope the community can point me in the right direction. I need to run a report against the Rent History table, and I expect the report to look like the Final Result. Please see the image for details.
There are three tags in the Rent History table. I was able to use ROW_NUMBER() OVER (PARTITION BY) to determine the On/Off Rent start date based on the position. This is where I stopped because I’m not sure what to do next. So far, this is the code that I have.