Viewing 15 posts - 1,096 through 1,110 (of 1,390 total)
basically what I need to do is to summarize the count of column "count2" for a every partition, and then subtract it to the field in "lead2" so, with...
March 24, 2020 at 4:12 pm
This uses the daterange function from this article: https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function
March 23, 2020 at 5:06 pm
drop table if exists #tblTest;
go
create table #tblTest
(ename varchar(10),
Amount float,
eDate date);
go
insert #tblTest values
('ABC',615.00,'03/23/2020'),
('ABC',540.00,'03/23/2020'),
('ABC',207.00,'03/23/2020'),
('PQR',449.00,'03/23/2020'),
('PQR',1065.00,'03/23/2020'),
('PQR',-2435.00,'03/23/2020');
declare
@max_dt ...
March 23, 2020 at 5:05 pm
Afaik and imo there are no pros only cons. There is no such thing as a "gap" in a primary key because 'unit consistency' is not a necessary...
March 23, 2020 at 4:37 pm
Afaik and imo there are no pros only cons. There is no such thing as a "gap" in a primary key because 'unit consistency' is not a necessary attribute. Maybe...
March 23, 2020 at 1:18 pm
I prefer to always use INNER and OUTER for clarity.
Clarity could not also come from conciseness? It seems to me adding extra information which is of questionable necessity adds...
March 19, 2020 at 9:10 pm
Steve and Jeff, thank you. Good to have other eyes on this. 🙂 What should I do with the earlier incorrect code? Wipe it out? Should I have kept updating...
March 19, 2020 at 8:33 pm
If dupes are ok but the alerttypeid may only be in (4, 6), then maybe this works
with only_two_cte(alertid) as (
select
...
March 19, 2020 at 7:54 pm
with only_two_cte(alertid) as (
select
alertid
from
#aaa
...
March 19, 2020 at 7:43 pm
Ok yeah I'm starting to see the alerttypeid's should be counted separately.
March 19, 2020 at 7:38 pm
with only_two_cte(alertid) as (
select
alertid
from
#aaa
...
March 19, 2020 at 7:03 pm
select distinct
first_value(alertid) over (partition by alerttypeid order by alertid desc) alertid,
alerttypeid
from
#aaa
where
alerttypeid in(4,6);
March 19, 2020 at 12:23 pm
;with
ordered_amounts as (
select distinct first_value(amount) over (partition by userid order by keyid desc) amount from #t)
select
sum(amount) total
from
ordered_amounts;
This...
March 18, 2020 at 11:57 am
;with
ordered_amounts as (
select distinct first_value(amount) over (partition by userid order by keyid desc) amount from #t)
select
sum(amount) total
from
ordered_amounts;
March 17, 2020 at 5:12 pm
I need one column for BSP between 1 and 3, one column for BSP between 3 and 5, one column for bsp between 5 and 8 (and up to...
March 16, 2020 at 12:52 pm
Viewing 15 posts - 1,096 through 1,110 (of 1,390 total)