Viewing 15 posts - 106 through 120 (of 414 total)
Try this:
select isnull(dt.usr_name, dt.off_name), dt.waiting, dt.sold, dt.dropped
from
(
select off_name, usr_name,
cast(sum(case when status = 'waiting' then amount else 0 end) as varchar)as waiting,
cast(sum(case when status = 'sold' then amount...
February 2, 2006 at 2:08 am
It's a complicated world...
Try this:
declare @IDs table(Id int)
set rowcount 1
-- execute the same SQL statement 3 times
insert @IDs select id from Games
where id...
February 1, 2006 at 7:22 am
Is this what you are looking for?
select off_name, usr_name,
sum(case when status = 'waiting' then amount else 0 end),
sum(case when status = 'sold' then amount else 0 end),
sum(case when status =...
February 1, 2006 at 6:45 am
Is this what you are looking for?
select col1 + col2 + col3 + col4 + col5 from table
Otherwise, please give us a small example with data and the expected output...
February 1, 2006 at 6:29 am
Are games always related in groups? In your test data, games 1, 2 and 3 are a group of related games. Similarly for games 6 and 7.
February 1, 2006 at 2:27 am
Good to hear - and you are absolutely right, I forgot "order by SKU_ID" in the function...
January 30, 2006 at 5:46 am
Very interesting - and surprising, at least to me...
I have removed the rest of my comments now that Jeff has rewritten his post...
January 30, 2006 at 3:17 am
OK - how about this one then? It uses a function that creates a comma separated list of SKU_IDs for a given CASE_NBR. To work correctly, ',' should not be...
January 30, 2006 at 12:39 am
I have some code that produces the output you want. It turned out to be more complicated than I thought it would be at first. My code requires that the...
January 27, 2006 at 5:13 am
Then try the following trick (which uses a function):
-- Test data
create table TABLE1 (ID int, FIELD1 varchar(10), FIELD2 varchar(10))
go
create table TABLE2 (TABLE1_ID int, ID int)
go
create function listValues(@ID int)
returns varchar(8000)
as
begin
declare @str...
January 27, 2006 at 3:19 am
How about using the modulo operator?
The first group would be "where id % 7 = 0". The next group "where id % 7 = 1" and so on up to "where...
January 26, 2006 at 7:51 am
If this is only to stop duplicates from being displayed, you might want to try the code below. Displaying a comma separated list is harder and performes worse... Let me know...
January 26, 2006 at 7:46 am
Do you have precisely two occurencies of each Id in your data (like in your test example)? Then you could try the following:
select Id, max(Name) + ',' + min(Name) from yourtable group...
January 26, 2006 at 2:06 am
Ray probably means that you should execute
select customerID, SomeString from mytable
and then put data on the desired form in your client program.
I was wondering if you have an additional column...
January 24, 2006 at 2:24 am
Viewing 15 posts - 106 through 120 (of 414 total)