Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

baskar
More...


Forums » .NET » SQL Server »

How to show value in one column based on the other column in sql???


Posted Date: 10 Aug 2012      Posted By:: vish     Member Level: Silver    Member Rank: 1642     Points: 4   Responses: 2



Hi,

I Have three columns viz Company, Owner Group, Process in table
The values in the process column is depend on the wner group.

For eg:
-----------------------
Owner Group Process
-----------------------
Apple Red
Grapes Green
Mango Yellow
Apple Red

Tht means if owner group has apple then in process column it should be red.
So guys pls help............

Thanks in Advance.............




Responses

#683942    Author: Ravindran        Member Level: Diamond      Member Rank: 3     Date: 11/Aug/2012   Rating: 2 out of 52 out of 5     Points: 3

Hi,

you can use CASE statement like this


create table t124(Ownr varchar(40),Grp varchar(50))

insert into t123 values('ravi','Apple')
insert into t123 values('ravi','Grapes')
insert into t123 values('ravi','Mango')
insert into t123 values('ravi','Apple')


select grp,case Grp when 'Apple' then 'Red' when 'Grapes' then 'Green' when 'Mango' then 'Yellow' end [Process] from t123


Regards
N.Ravindran
Your Hard work never fails



 
#683943    Author: Prasad kulkarni        Member Level: Diamond      Member Rank: 8     Date: 11/Aug/2012   Rating: 2 out of 52 out of 5     Points: 2

What you want exactly ?
do you want to fill table with updateQuery ?
do you want to show data in gridview ?
can you elaborate your problem so that we can help you more

Thanks
Koolprasd2003
[DotNetSpider MVM]



 
Post Reply
You must Sign In to post a response.

Next : What is differences between sqlserver2005 and sqlserver2008
Previous : Update the highest value
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.