Thread: Query Problem
View Single Post
  #5 (permalink)  
Old October 21st, 2003, 07:32 AM
SubodhKumar SubodhKumar is offline
Authorized User
 
Join Date: Oct 2003
Location: Delhi, Delhi, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SubodhKumar Send a message via Yahoo to SubodhKumar
Default

Hi mateen,
Try this query,


select FromNode,ToNode,volume,'value'=
    Case
        When right(fromNode,1)='1' and right(toNode,1)='0' Then '1353'
        When right(fromNode,1)='1' and right(toNode,1)='2' Then '47'
        When right(fromNode,1)='2' and right(toNode,1)='8' Then '243'
        --add more condition here
        --.........................
        else 'Last Character is not beetween 1 & 8'
    End
from Data --The Table name

Quote:
quote:Originally posted by mateenmohd
 I have data like this
Table Name’s DATA
data type is int

FromNode ToNode Volume
10011 10010 1353
10011 10012 47
10012 10018 243
10011 10012 50
10015 10014 377
10011 10016 976
10011 10018 0
10012 2755 1586
………… and so on……….. thousand of records in sql server table

How can retrieve the data from the above table
if last character of FROMNODE column is 1 and last character of TONODE column is 0 to display value 1353.

If last character of FROMNODE column is 1 and last character of TONODE column is 2 to display 47

If last character of FROMNODE column is 2 and last character of TONODE column is 8 to display 243

If last character of FROMNODE column is 1 and last character of TONODE column is 2 to display 50 and so on……

What programming query, function will use to retrieve the data from the above table ?
Last value of FROMNODE and TONODE column always between 1,2,3,4,5,6,7 or 8.

Please help

Mateen


Enjoy!
Subodh
Reply With Quote