Viewing 15 posts - 331 through 345 (of 902 total)
Having reformated the query at the bottom of the code you submited
select distinct
customer.*
,CustomerColor.Color
,CustomerColor.CustomerSubject
,b.AkharinKeraye
,b.Karkard
,b.Lcall
from customer
left outer join CustomerColor on Customer.CustomerColorID=CustomerColor.CustomerColorID
,(select [Service].CustomerID
,max([Service].SabtDate) as Lcall
,SUM(Service.Gheymat) as Karkard
,(select s.Gheymat
from...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 12, 2013 at 2:16 am
You need to alias the Inner select
Eg
select count (*)
from
(SELECT top 100 percent Form.FormName, Markets.MarketName
FROM Form INNER JOIN
FormMarkets_Link ON Form.FormID = FormMarkets_Link.ptFormID INNER JOIN
Markets ON FormMarkets_Link.ptMarketID = Markets.MarketID CROSS...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 9:32 am
Chris,
I've never seen the recursive CTE method before, and looks like a viable option to the quirky update to a point.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 6:52 am
You might wnat to revisit the code, I would suggest reading this article http://www.sqlservercentral.com/articles/T-SQL/61539/ and then look at a turning this into a Quirky update for the Running total, something...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 6:06 am
I think the problem with most MS based training courses is that they often focus on only the new shiny-shiny toys that you get, eg in T-SQL for 2012 these...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 4:04 am
Mike John (2/11/2013)
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 2:07 am
Bruce W Cassidy (2/8/2013)
Lynn Pettis (2/7/2013)
Better advice, yes, but hard to follow if the boss says you must use them.
declare @success bit;
exec CurriculumVitae_prepare;
while (1=1) begin
exec Job_Apply...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 12:56 am
You probably want to look at using SSIS with Excel as a destination.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 11, 2013 at 12:13 am
this
select top 100 ID,
count (*)
from [database]..
group by id
order by count (*);
should be
select top 100 ID,
count (*) myCount
from [database]..
group by id
order by myCount;
to order by the Count...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 8, 2013 at 5:16 am
I believe Gail had this in mind,
SELECT
CalendarMonth
, CaldendarDate
From Table
Order by CalendarMonth
By Default the data is ordered ASCENDING, NOTE : varchar/char (etc) fields will sort differently depending on factors such...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 8, 2013 at 5:09 am
BOL states that OpenRowSet can be used as a Target in the merge but appears to be ambiguous as to whether it can be a source.
Have you tried loading...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 8, 2013 at 3:29 am
If I understand correctly the Second statement shouldnt run if the first statement updates rows, if it doesnt update any rows then the second statement should run, if that is...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 8, 2013 at 12:01 am
Sean, I've alread shown a simle proof for Tally vs Loop on this thread (http://www.sqlservercentral.com/Forums/Topic1416507-1292-1.aspx) on
Unfortunately hes been told to use the While loop by his boss. My...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 7, 2013 at 8:55 am
Dont you have it insert the data into the return table @retCHFPatients?
so I think your select should read something like
INSERT INTO @retCHFPatients
SELECT
@MonthNumber = month(a.DischargeDateTime),...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 7, 2013 at 8:07 am
good luck, I hope this is being used as a 'wrong' way of doing something rather than the right way.
I would pick up a couple of books on SQL programming,...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 7, 2013 at 5:42 am
Viewing 15 posts - 331 through 345 (of 902 total)