Viewing 15 posts - 46 through 60 (of 4,075 total)
Please create sample data in a consumable format using the {;} Code
button to include a script to create a TEMP table and insert data into that temp table.
Drew
April 11, 2024 at 2:12 pm
Drew, your solution doesn't list the new company. It only lists the original one. Do you know why?
Yes, there was an error in my code. I was thinking that...
April 4, 2024 at 3:11 pm
Couldn't it be as straightforward as this??
SELECT t.[pick your columns]
FROM SomeTable t
INNER JOIN (SELECT [ID#]
...
April 3, 2024 at 8:15 pm
I used a calculated field to combine these into a single query.
WITH Stop_Fl AS
(
SELECT *
...
April 3, 2024 at 8:06 pm
This gives the exact same results as Jonathan's but only reads the near and next term data tables once each.
SELECT FP.UNDERLYING_SYMBOL,
...
April 2, 2024 at 6:46 pm
The problem with your question, is that you've not given enough data to rule out potential incorrect queries. For example, SELECT * FROM dbo.history
returns the correct results for your...
April 2, 2024 at 6:24 pm
You need multiple OPENJSON
functions.
select j.WorkId, r.[Busket Rule], r.Exit_Window, r.Startegy, r.Start_Date
from openjson(@json)
with (
WorkId int '$.WorkId',
OverrideRules NVARCHAR(MAX) '$.UpdateAttributes.OverrideRules' AS JSON
) j
CROSS APPLY OPENJSON(j.OverrideRules)
WITH (
[Busket Rule] varchar(200) '$."Busket Rule"',
Exit_Window...
April 2, 2024 at 5:53 pm
This gives the exact same results as Jonathan's but only reads the near and next term data tables once each.
SELECT FP.UNDERLYING_SYMBOL,
...
April 2, 2024 at 5:36 pm
One more thing. There is no reason to use an explicit CAST
here, and using an implicit CAST
makes it much easier to read.
/* Explicit CAST ...
April 1, 2024 at 3:41 pm
Please clean up your code before posting. There are several issues with the code for your test data.
April 1, 2024 at 3:28 pm
The problem is that you haven't defined "total up" and "total down".
Is it a change on the field "up"? If so, your data is incomplete. A value can be up,...
March 26, 2024 at 4:34 pm
This query produces the exact same results as your query with far fewer reads.
WITH Order_Statuses AS
(
SELECT h.order_number
, h.order_date
, q.[label]
, q.orderstatus_src
, q.orderstatus_tgt
, h.order_status
...
March 26, 2024 at 3:21 pm
For future reference, many people are wary of opening random files from the Internet. If you want help, please post a script to create a TEMP table and insert the...
January 30, 2024 at 9:32 pm
You can't generally define aliases INSIDE expressions.
Drew
PS: You're dates don't match.
December 28, 2023 at 6:20 pm
Yes, that's a bit shorter and generally more efficient. I'm wondering if there were a lot more that 12 items per customer and the right indexes on the table...
December 26, 2023 at 3:09 pm
Viewing 15 posts - 46 through 60 (of 4,075 total)