Viewing 15 posts - 256 through 270 (of 4,087 total)
You're UPDATE
statement is incorrect. If you are going to alias something, you need to use that alias throughout.
UPDATE o -- use the alias here.
SET o.Description =...
February 10, 2020 at 10:43 pm
A picture of your data is worthless.
{;} Insert/edit code sample
that does the following.February 10, 2020 at 4:47 pm
Your "header" row has five columns, but your details rows have eight. Without knowing what your final goal is, it's hard to tell you the best way to resolve this...
February 10, 2020 at 4:31 pm
This is much more efficient. Note that it has a windowed function SUM() OVER()
of an aggregate SUM()
.
SELECT
per
,company
,account
,COUNT(*) AS accNum
,SUM(amount) as accTotals
,SUM(SUM(amount)) OVER(PARTITION BY per, company) as...
February 7, 2020 at 5:13 pm
I'm not sure that all the answers given in this thread are correct?
The where clause, if indented, looks like this:
WHERE 1 = CASE WHEN T.record_Key_4 =...
February 7, 2020 at 4:55 pm
This is a variation on packing intervals. Itzik Ben-Gan has written a number of articles that might be helpful. If you post consumable data I can help you with it. ...
February 6, 2020 at 5:32 pm
You're doing a partial CROSS JOIN. You either need to SUM your totals before joining or do a UNION before SUMming. You could also use GROUPING SETS. Since you failed...
February 5, 2020 at 5:17 pm
Hi
Sorry, i got caught up doing another project....
Honestly, I "sorta" get what's going on here,
STUFF(
...
January 29, 2020 at 4:56 pm
Show us what you've tried and we'll help you through it. There are a couple of ways to approach it. I would probably start by changing what nodes are returned...
January 24, 2020 at 3:19 pm
I used an XML variable, but you can easily replace the variable with your field.
SELECT STUFF(
(
SELECT ',', c.value('.', 'VARCHAR(20)')
FROM @doc.nodes('/Data/Purpose_x0020_of_x0020_Request/Data_Purpose_x0020_of_x0020_Request_Option[Checked="true"]/Name') T(c)
FOR XML PATH(''), TYPE
).value('.', 'VARCHAR(255)'), 1, 1,...
January 23, 2020 at 11:15 pm
The query you provided appears to be doing something like a running count of passengers on each event but it doesn't quite get it right. I need just one...
January 23, 2020 at 4:06 pm
When you provide sample data DO NOT USE A PERMANENT TABLE. You should either provide a temp table or a table variable.
When you provide sample data, the VALUES
clause can...
January 22, 2020 at 10:58 pm
I see nothing in your data that indicates that you picked up 9 people at the same time/location. There is no way to provide a solution without that field. If...
January 22, 2020 at 10:53 pm
You were already given an answer to this in your previous thread.
Drew
January 22, 2020 at 8:58 pm
EXCEPT
is unlikely to be the best performing solution here, because it requires you to read the table twice and there are other solutions that should only require reading the...
January 22, 2020 at 3:30 pm
Viewing 15 posts - 256 through 270 (of 4,087 total)