Viewing 15 posts - 961 through 975 (of 4,080 total)
It depends. The Row_Number() technique wins at low volumes and the MAX() function performs better as you start moving up to to tens of thousands of rows....
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 3:17 pm
This post intentionally left blank.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 2:26 pm
bubs,
This may be an irrelevant question, but how many rows are you planning on running against? If this is a one time shot it's...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 2:11 pm
I am about to go out of town for several days, so this will be my last post, but you seem to be on the right track. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 1:00 pm
I don't really know of anything more "comprehensive". Ranking is based on a criteria of some sort which must be defined. In your example for...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 11:04 am
Chrissy,
Please note that the query using the revised design provides output in this format
Staff_ID Phone_nbr
1 ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2011 at 9:13 am
Sounds like an interesting problem, but we need a little more help before we can offer a solution.
Could you give us a little more information?
What would...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 4:07 pm
You're welcome.
CTEs are just like views, except you define them for the duration of a single query.
Alternatively, think of them as subqueries that you read from top to bottom,...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 2:16 pm
Try this instead of the PIVOT. See if it helps.
select site
, sum(case when [status] = 'Available' then 1 else 0 end) as Available
, sum(case when [status]...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 1:19 pm
Here's a shot at your first requirement. For a high-volume table I'd probably use a cursor, or even let the calling application highlight the consecutive rows....
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 1:10 pm
You get an A+ for setting up the problem so perfectly. Thank you so much!! 😀
Here's a solution for you
select StaffID
,COALESCE(case...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 12:48 pm
GilaMonster (7/20/2011)
Ninja's_RGR'us (7/20/2011)
GilaMonster (7/20/2011)
Jeff Moden (7/20/2011)
I understand that Gail Shaw will be co-presenting with you...Yup, Grant and I are doing comed^H^H^H^H^H execution plans as a precon on the Monday.
What...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2011 at 9:17 am
... and he feeds pork chops to the hungry multitudes.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 19, 2011 at 3:37 pm
Call the people at SETI[/url]. 😀
Seriously, I think T-SQL may be the wrong tool for the job of discovering undefined patterns. This sounds like it's more in...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 19, 2011 at 10:56 am
Thanks, Theomed. 🙂
They aren't rules; they are just suggestions. But they are REALLY helpful suggestions.
What you posted, enabled me to produce this...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 19, 2011 at 10:45 am
Viewing 15 posts - 961 through 975 (of 4,080 total)