Viewing 15 posts - 736 through 750 (of 1,229 total)
Jeff Moden (12/21/2011)
December 22, 2011 at 1:45 am
DECLARE @GroupPartitionSize INT
SET @GroupPartitionSize = 6 -- 700 in your actual data
SELECT
grp_no,
cnt, -- workings, not part of solution
...
December 22, 2011 at 1:15 am
drew.allen (12/21/2011)
ChrisM@home (12/21/2011)
Secondly, use COALESCE(ExistingColumn, StagingColumn) like this to handle the NULL issue:ExistingColumn = COALESCE(ExistingColumn, StagingColumn)
Actually it sounds like he wants to overwrite the existing column if both the existing...
December 22, 2011 at 12:43 am
This is very very basic TSQL and looks like homework. Please read the link in my sig which will show you how best to ask questions and post sample data....
December 21, 2011 at 5:37 am
Hi Andrew
Firstly, try the MERGE statement for upserts, that's what it's for and it makes for clear and performant code.
Secondly, use COALESCE(ExistingColumn, StagingColumn) like this to handle the NULL issue:
ExistingColumn...
December 21, 2011 at 5:32 am
alishaik001 (12/21/2011)
here Name is the fieldName and Employee is the TableName;
SELECT Name FROM Employee GROUP BY Name HAVING ( COUNT(Name) >= 1 );
From this query I got...
December 21, 2011 at 5:23 am
alishaik001 (12/21/2011)
I get this by the following query:SELECT Column_Name FROM TableName GROUP BY Column_Name HAVING ( COUNT(Column_Name) >= 1 );
Can you post the actual query you are using? The query...
December 21, 2011 at 5:11 am
VIG (12/21/2011)
even more simple 🙂declare @subgroupsize int
set @subgroupsize=3
select dense_rank() over(order by act,grp desc) grp_no,1+(rn-1)/@subgroupsize grp_sub_no
,grp,member,act
from
(select * ,ROW_NUMBER() over(partition by act,grp order by (select...
December 21, 2011 at 3:14 am
mikes84 (12/20/2011)
grp_sub_no = ((rn+2)/3*3)/3
The actual number I'd like to split the groups up by is 700....
December 21, 2011 at 12:57 am
Hi Mike
NTILE() is great for splitting tables into equal partitions for e.g. marketing, I think this better suits your requirement:
SELECT
grp_no,
grp_sub_no = ((rn+2)/3*3)/3,
grp,
member,
act
FROM (
SELECT...
December 20, 2011 at 2:53 pm
Left-join table2 twice, once for each condition. Resolve the dispute in the WHERE clause and the output using CASE.
December 20, 2011 at 8:02 am
APPLY is explained in Paul White's papers - links are in my sig. It's somewhat similar to putting a correlated subquery in the FROM list. Read the papers - APPLY...
December 20, 2011 at 1:34 am
ramadesai108 (12/19/2011)
SELECT COUNT(*)
FROM Departments INNER JOIN
...
December 19, 2011 at 2:00 pm
Hi Doug, welcome to the forum. This is a Running Total project, and there are several ways of getting the output you're expecting. The fastest is the Quirky Update (QU),...
December 19, 2011 at 9:56 am
Revenant (12/18/2011)
L' Eomot Inversé (12/18/2011)
December 19, 2011 at 9:04 am
Viewing 15 posts - 736 through 750 (of 1,229 total)