On Behalf Of Maya_Zakry
Jan 23, 2007
quote:Originally posted by maya_zakry
hello, can someone fix my multiple case statement..
SELECT col1, col2 from tblOne
CASE
WHEN (substring(d.StorageStatus,1,1)='H') THEN
Sum(d.HoldQty)
WHEN (substring(d.StorageStatus,1,1)='Q') THEN
Sum(d.QCQty)
ELSE
sum(ISNULL(d.OriginQty,0))-sum(ISNULL(d.HoldQty,0))- sum(ISNULL (d.QCQty,0))- sum(ISNULL(d.BookQty,0))- sum(ISNULL(p.PickQty,0)) AS BalQty END
AS BalQty
WHERE blablah
is this multiple case allowed?
NO!
But if you are trying to sum up different columns depening on some status column, try thisselectcol1,
col2,
sum(case
when d.storagestatus like 'h%' then isnull(d.holdqty, 0)
when d.storagestatus like 'q%' then isnull(d.qcqty, 0)
else isnull(d.originqty, 0) - isnull(d.holdqty, 0) - isnull (d.qcqty, 0) - isnull(d.bookqty, 0) - isnull(p.pickqty, 0)
end) as qty
fromtblone
group bycol1,
col2
order bycol1,
col2
Peter Larsson
Helsingborg, Sweden
View 4 Replies
Feb 22, 2006
hello,
can xp_sendmail send on behalf of someone, i.e. i need to send it from a sql profile mailbox, but i need the address to read FROM: Someoneelse@domain.com
i know you can do this easily with XPSMTP, but i need a way to do it with xp_sendmail (sql mail)
thanks
View 1 Replies
View Related
Jan 17, 2008
Hi all ..
I am new to sql server reporting services. I have two parametrized fields(database) in the report and i want to populate the second one on behalf of the first dropdownlist's selected item.
Thanks in advance for your valuable replies
Regards
View 1 Replies
View Related
Mar 13, 2008
HI,
is there any statement by using that i can delete data from the table on behalf multi rows.
like
delete from Table where = (select id from table1 where group=1)
second statemetn returns 4 rows by group =1
is there single statment..
Thanks
View 2 Replies
View Related
Jul 2, 2015
Picture tells all what i need. Anyway i want to combine upper two tables data like below result sets. Means they should be grouped by bsns_id and its description should be comma separated taken from 2nd table. In sql server 2012 ....
View 5 Replies
View Related
Jul 2, 2015
i want to combine upper two tables data like below result sets. Means they should be grouped by bsns_id and its description should be comma separated taken from 2nd table. In sql server 2012.
This is the image path :
[URL]
View 3 Replies
View Related
Mar 27, 2008
Hi Guys..
i don't know weather is it possible or not..but Can any One tell's me How can i refresh the Chart Values.. acutally what's happening..
i have two Chart in a reprot .. One is Main Category and other one is SubCategory... acutally what i want.. in Main Category chart sum of Quantities of Subcategory values comes in bar or any other format.. and when i click on Main chart any bar it's refresh the other chart and return the result of subcategory under that main category in details...
i don't know is this possible .. acutally i m very new in reproting.. infact that's my first report.. so i want to do this.. if any article or any help anyone can provide me..
Thanks
View 1 Replies
View Related