Viewing 15 posts - 106 through 120 (of 327 total)
When using Group By all columns must be included in the Group By clause OR in an aggregate statement (min, max, sum etc.)
Aggregate statements are always applied at the group...
June 4, 2005 at 3:24 pm
select substring(account_number,2,4) as accnt_no,
min(description_1)
from chart_of_accounts
(Edit) Group By substring(account_number,2,4)
June 4, 2005 at 3:16 pm
select right(left(account_number,5),4)as accnt_no,
min(description_1)
from chart_of_accounts
group by right(left(account_number,5),4)
June 4, 2005 at 3:10 pm
David's suggestion uses min(). As the table becomes larger this gets to be more inefficient as more rows have to be evaluated.
Another variation on what I posted that should be better...
June 4, 2005 at 9:20 am
Is this what you are looking for?
Declare @temp table
(
row_id int identity (1,1),
product varchar(50)
)
Declare @i int,
@max-2 int
Insert into @temp (product)
Select product
From products
set @max-2...
June 3, 2005 at 6:05 pm
Your main proc needs to test return values after execution of each procedure call and determine a course of action based on success or failure.
June 3, 2005 at 12:40 pm
This also may help. It has a section on XACT_ABORT.
http://www.sommarskog.se/error-handling-II.html#presumptions
Here's part of the article:
"...Even if XACT_ABORT is ON, as a minimum you must check for errors when calling stored...
June 3, 2005 at 12:14 pm
No big deal getting the time from a datetime or smalldatetime.
select Right(convert(varchar,getdate()),7) as Time
Time
-------
8:50PM
June 2, 2005 at 7:05 pm
Remi,
Thanks for cleaning up my error. I don't think I was quite awake when I made that post
June 2, 2005 at 10:27 am
...
From Customer c1
...
WHERE Customer.custSegment='Retail'
AND Customer.campaignId='43'
AND Customer.IsActive='1'
AND CampBaseRep.Owner='1'
And Customer.customerId IN
(Select top 3 customerId
From Customer c2
WHERE Customer.custSegment='Retail'
AND Customer.campaignId='43'
AND Customer.IsActive='1'
And c2.customerId = c1.customerId
Order By...
June 2, 2005 at 8:19 am
Remi,
Yes, that was the thread. Anyway, I thought I would post that idea just it case it may have been helpful to someone.
June 2, 2005 at 7:58 am
I'm pretty sure someone asked this or a very similar question recently. I have not be able to find the thread.
If I recall one answer was to to select the...
June 1, 2005 at 6:48 pm
What's wrong with the date format you see in the query analyzer?
What format would you like to see?
June 1, 2005 at 6:08 pm
"select * from table where DateTest between 02/06/2005 and 01/01/2005 i do not find anything (no error recorded), but I am sure there are record with dates within the interval...
June 1, 2005 at 5:59 pm
Viewing 15 posts - 106 through 120 (of 327 total)