Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Location
    ISHHHH
    Posts
    130

    Unanswered: School Work(regarding Case)

    i had two table salary & salgrade
    Salary table is like
    Code:
    Empid   FirstName     Lastname      Title                   Salary
    1	  Vamsi	      Kashyap      DbDeveloper	        15000	
    2	  Gattu	      Kumar	       Programmer	        20000	
    3	 Ratna	      Kumar         Programmer	        20000	
    4	 Hema	      Kumar	       MD	                115000	
    5	 CH	              Satish	       Developer	        25000	
    6	 Ravi	              Kanth	       DBA	                35000	
    7 	 Mohammed      Naeem	       Admin	                45000	
    8	 Sriram	      Rahi	       HR	                80000		
    9	 Pardha	      Saradhi	      Accountent	        45000	
    10	 Bhushan	      Ivutry	     ProjectManger	75000
    Second Table Salgrade is

    Code:
    Grade   LowSal    HighSal
    A	  50001	150000
    B	  20001	50000
    C	  10001	20000
    D	  5001        10000
    E	  1001        5000
    i want to write a case which will give a o/p like
    Code:
    EmpId FullName Title         Salary  Grade
    5       CH Satish Developer 25000   B
    it is so simple but making me confuse so plz help me
    WiTh Tnks & ReGaRdS
    mAtHuKuMaLi

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I will help you through this.
    Firstly, please can you post what you have tried so far?
    Secondly, do you expect the answer to use a CASE expression, and if so why?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jul 2010
    Location
    ISHHHH
    Posts
    130
    i am learning about case i am able to use case in one table but unable to use it in two tables so i asked this
    WiTh Tnks & ReGaRdS
    mAtHuKuMaLi

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    The answer to this question does not require CASE.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jul 2010
    Location
    ISHHHH
    Posts
    130
    yes you are right the o/p can come by with out using case by just
    Code:
    Select Empid, FirstName + ' ' + Lastname as FullName, 
    Title, Salary,
    (Select Grade from SalGrade 
    where S.Salary > LowSal and  S.Salary <= HighSal)
    as EmpGrade from Salary S
    by this i can get my output but just i need to use case condition to know about case condition
    WiTh Tnks & ReGaRdS
    mAtHuKuMaLi

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Using CASE for a one table query is no different to using it in two, three, twenty table query.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •