I have 4 tables ProjectTable projectid: INT (pk) modifiedDate: DateTime2 … ProjectFinalizeTable id: INT (pk) projectid: INT (fk) modifiedDate: DateTime2 … ProjectAdditionalTimeTable id: INT (…
Tag: sql-server
How do you populate boolean columns based on a table of properties?
I have a table called Product that contains a product identification number and an id associated with the product identification number. pin id 11 10 12 11 13 12 I also have a property table with the …
How can I override rows from another table?
I have two tables: TableA ID Name — —- 1 aaa 2 bbb 3 ccc 4 ddd TableB ID Name — ——– 3 WWXXYYZZ I want to select from both tables, but skip the rows which exist in TableB. The …
Full Join using a fuzzy join but with distinct matching
We have a table of expected payments and a table of payments made. We need to be able to match payments with a singular expected payment but we allow a +-3 day window for it to be made. On top of that, it should be a one-to-one match. So imagine I have a table of expected payments and payments The
How to query across multiple databases
I have a set of data that belongs to two different tables in two different databases. I have performed the query but I am getting a syntax error. The two databases are: This is what I am doing: Why would it give me an error on this part? as the syntax appears correct Any help is appreciated. Answer This Back.…
Editing the data
In the picture, you will see a table at the beginning that contains NULL in the Rounds column. After that, it shows 9th. How can I edit the data from 9th to NULL? SELECT TOP (1000) [Rank] ,[…
How to use the COUNT function
I’m trying to set up the best basketball team for fantasy basketball in the 2020-2021 season. I created a database for basketball player’s stats and imported a table that contains projections and draft rankings for this coming season. I’m focusing on players who play in the center position, …
Transpose rows into columns in SQL Server, I try it using pivot but, expected result is not reached
Transpose rows into columns in SQL Server, I try it using pivot but, expected result is not reached, using pivot getting Max value only Expected output: Answer You can use conditional aggregation with row_number():
Conditional query with a parameter stored procedure
I’m learning SQL so I don’t know yet all the subtlety of the language, I wrote the following stored procedure (simplified here): But it doesn’t look like a natural way to do that and there is a lot of repeated code. I want to avoid something like But if it’s the only way. I don’t…
Passing date variable in Power Query to ODBC source
I have managed to extract a date from Excel (that the user can amend).[A named range called DateB]. I want to be able to pass that to a variable in the sql part of Power Query so that various checks can be made before passing the data back. However, I cannot get the variable @man_Date to accept the date that