Viewing 15 posts - 1 through 15 (of 94 total)
I resolved it with the following code.
SELECT
mg.[name] AS group_name,
NULL AS subgroup_name,
cmc.country_id
FROM dbo.starui_country_mastergroup mg
INNER JOIN...
May 6, 2025 at 7:20 am
I've come up with this T-SQL but it doesn't show the master group country id only the sub group country id. I need both in the country id column.
May 5, 2025 at 5:55 am
Thanks for the reply.
Yeah the 6th table stores the codes and isn't need for this task. Unofrtunaely I didn't create this just inherited it, I have already my concerns with...
May 4, 2025 at 11:26 pm
Thanks for the reply, I have resolved the problem with a self referencing LEFT JOIN on the non measure columns.
May 1, 2020 at 2:13 am
INSERT [dbo].[Hier_table] ([Dimensions], [Management], [Management_Name], [Level]) VALUES (N'OBU1', N'GPFX', N'XXX Elephant Total', 2)
GO
INSERT [dbo].[Hier_table] ([Dimensions], [Management], [Management_Name], [Level]) VALUES (N'GPFX', N'GPS1', N'XXX XXX Fire Total', 3)
GO
INSERT [dbo].[Hier_table]...
February 17, 2020 at 5:28 am
I have attached a small sample expected output as CSV and a screen shot. Level 2 & 3 are only one row but the other rows can be one or...
February 16, 2020 at 10:18 pm
I came up with the following self referencing CTE but its not moving along the levels, so IDK.
With CTE
AS(
SELECT Dimensions,Management,[Description], [Level]
FROM [dbo].[Hier_table]
WHERE Dimensions = 'OBU1'
UNION...
February 13, 2020 at 6:30 am
I am not trying to 'game the system' I want to improve my understanding of cursor's. Any company can ask many different questions and will also change there questions. I...
October 3, 2019 at 7:01 am
Thanks for the reply.
Why are you minus id from row number?
[p].[id] - ROW_NUMBER() OVER (PARTITION BY [p].[product_name] ORDER BY [p].[id], [p].[start_date])
May 23, 2018 at 5:45 pm
I don't have access to the tables as it was a test this morning and I wanted to work it out. You have put the max inside the inner query...
May 23, 2018 at 6:45 am
The business can't give me a clear answer on what they are doing. Old spreadsheets they have using for so many years and no one knows 🙂 Thanks for all...
May 8, 2018 at 12:23 am
mmm good point, didn't think of that not sure I will find out tomorrow.
May 6, 2018 at 7:26 am
Thanks a lot for the script. Can you explain the logic behind it so i can understand it?
May 5, 2018 at 3:34 am
Thanks for the reply, but how do i apply your cte's to my statement?
May 4, 2018 at 4:45 pm
Viewing 15 posts - 1 through 15 (of 94 total)