It would be helpful to have some table and column names to work off and a few examples.
Main Topics
Browse All Topicshi i have to write a sql query
i have sku aaa
sku bbb
sku ccc
sku abc
sku acc
i have to write a query.when on invoice only if it is only sku aaa then it is cost + 10. if it is with other products then cost for aaa is 0 dollars but for other products it is cost + 5. how can i write that one
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
angellll this is the result i got it didnt add the cost + 5 for other products but it added cost + 10 for the sku 2861 but if it is with other products on the same invoice then also it added as cost + 10 if it is on the same invoice with other products it should be $0 for that sku2861. this is the query that i have return
select tp.globalproductid,tp.seri
case when tp.globalproductid = 2861
then case when exists(select null
from arjayiqm.arjaytelecom.dbo.
where tpp.transferid = tp.transferid and tp.globalproductid <> 2861)
then 0 else 10 end
else
case when exists(select null
from arjayiqm.arjaytelecom.dbo.
where tpp.transferid = tp.transferid and tp.globalproductid = 2861
) then tp.unitcost + 5 else tp.unitcost end
end newcost
from arjayiqm.arjaytelecom.dbo.
arjayiqm.arjaytelecom.dbo.
where t.storeidto= 46
Business Accounts
Answer for Membership
by: RQuadlingPosted on 2008-03-14 at 14:21:12ID: 21129677
So, are these statements correct.
1 SKU only on invoice. SKU is AAA. Cost is +10
More than 1 SKU on invoice. Cost is +5 except when SKU is AAA