Viewing 15 posts - 1,201 through 1,215 (of 13,838 total)
Something like this, perhaps?
SELECT Mth = MONTH(t.start_date)
,t.IsMember
,TotalTrips = COUNT(*)
FROM trips t
WHERE YEAR(t.start_date) = 2017
...
August 26, 2022 at 11:36 am
If there's a lot of data involved and you're likely to be running regular analyses on it, I'd consider setting this up in a Tabular Model and using DAX...
August 26, 2022 at 7:14 am
Without knowing the structure of your tables, this is impossible to answer with any certainly.
In line with Jeff's question, I would have expected 'Last week actuals' to be, in pseudo-code:
August 26, 2022 at 7:06 am
It seems my insistence on unique column names was misguided. This is not required.
I am using a temp table while working on your code. Please try executing the following and...
August 25, 2022 at 2:55 pm
2- I don't see a good way to organize the SQL code in SSMS in Separate folders (like HR Code, Finance Code, Etc..). I can certainly prefix the solution/project...
August 25, 2022 at 2:42 pm
Oh and never use SELECT * in production code.
You have to be careful when using words like 'never'! In my opinion, there is nothing wrong with using SELECT *...
August 25, 2022 at 10:59 am
Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread. Thanks for creating...
August 25, 2022 at 9:11 am
I find such formatters to be a bit of a pain in the ass when I need to deviate from what the formatter thinks is a good idea.
If someone...
August 25, 2022 at 8:23 am
Here is another attempt, this time with dynamic column names. As mentioned before, column names must be unique, so I added some suffixes to ensure this.
DECLARE @C0...
August 24, 2022 at 8:52 am
WHERE OrderDate >= DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0)
AND OrderDate < DATEADD(DAY, 15, DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0))
August 24, 2022 at 7:44 am
Thanks for your reply Phil, Someone suggested PIVOT would do this, so I was trying to figure out how to do that. While this would be the answer if...
August 23, 2022 at 9:54 pm
Perhaps post a few specific questions in the SSIS forum. You need only a rudimentary knowledge of C# to achieve most of the things you'll need to use a Script...
August 23, 2022 at 12:46 pm
Exporting to CSV may also solve the problem, because then you have full control over the target datatypes.
August 23, 2022 at 11:22 am
The following method is likely to be faster and easier to read than PIVOT:
(Note that column names must be unique)
SELECT PKGId = ct.PC_Pkg_Id
...
August 22, 2022 at 4:28 pm
Try using exactly the same query as your source, but with none of the CONVERTs, and see what happens.
August 22, 2022 at 2:49 pm
Viewing 15 posts - 1,201 through 1,215 (of 13,838 total)