Viewing 15 posts - 8,746 through 8,760 (of 15,381 total)
Ahh gotcha. Don't understand the usefulness of something like this but this is how you would do the query.
select ActNo, max(case when ProcessMonth = '2012-Jul' then PlanName else '' end)...
April 10, 2013 at 1:58 pm
Is it as simple as this?
select ActNo, PlanName, COUNT(*)
from #tempo1
group by ActNo,PlanName
order by ActNo
April 10, 2013 at 1:26 pm
Lynn Pettis (another long time poster around here) pointed out there is a LOT more wrong with your query. I didn't bother to look past the hideous formatting but he...
April 10, 2013 at 10:24 am
You need to update stats and rebuild your indexes.
April 10, 2013 at 10:01 am
It looks you have built both versions. Have you tested them? I would recommend nesting all of your replaces instead of doing them one at a time over and over....
April 10, 2013 at 7:58 am
dwivedi.neeraj (4/9/2013)
At least not for me.Its giving 6, 1 & 3 respectively.
Ahh it is a different dataset. I used the original one from the OP. 😛
April 9, 2013 at 3:08 pm
dwivedi.neeraj (4/9/2013)
Phil & Sean both are right but you can use something like this..Insert into Table2 (col3)
Select col1 + ' ' + col2 from table1
dwivedi.neeraj's approach will work pretty much....
April 9, 2013 at 3:04 pm
dwivedi.neeraj (4/9/2013)
Here is mine.
create table playground.sale (email varchar(255), quantityint);
insert into sale values ('email1', 1);
insert into sale values ('email1', 2);
insert into...
April 9, 2013 at 2:50 pm
PSB (4/9/2013)
I want to eliminate PrevTrans 1,2,9 because for the same site,location and code because PrevTrans 2 and 9...
April 9, 2013 at 2:48 pm
Lynn Pettis (4/9/2013)
NineIron (4/9/2013)
I'll supply the year through a variable but, let's start with 2013.
Okay, now I am totally lost. Given a specific date (getdate() in this case), return...
April 9, 2013 at 2:29 pm
dwivedi.neeraj (4/9/2013)
No, min or max would produce a different result that what he is expecting. Min will produce 1 and max will produce 3.
I realize that part of this is...
April 9, 2013 at 2:25 pm
Oops. Sorry.
Use getdate() instead of ApptDt. So, what is Saturday's date, given the week number?
This will change year to year. What year do you want?
--EDIT--
Bitten by the quote bug.
April 9, 2013 at 1:51 pm
dwivedi.neeraj (4/9/2013)
So if you use
select sum(distinct(s.quantity))--,s.email
from sale s
inner join eval e
on s.email = e.email
where s.email = 'email1'
if will give you correct result....
April 9, 2013 at 1:41 pm
Try this as a starting point. The problem is you don't have distributed transactions enabled.
http://stackoverflow.com/questions/1258983/problems-with-msdtc-remote-transactions
A google/bing search of your exact error message returns hundreds and hundreds of explanations of how...
April 9, 2013 at 1:18 pm
Sounds to me like you are trying to use SUM when what you really want is a different aggregate. Maybe MIN, MAX or even simply "top 1 order by something"...
April 9, 2013 at 1:10 pm
Viewing 15 posts - 8,746 through 8,760 (of 15,381 total)