Jump to content

sql experts please come


4Vikram

Recommended Posts

i have a requirement like this..

Select AB, AC, AD, AE FROM Tbl.ABC 

Aite AD lo values are like Alabama, Alaska, Arkansas and so on..

I need to create a view which gets me results like 

IF AD = Alabama then 1 if AD = Alaska then 2 atla continuation and this will be like an added new column AF anukondi.. suggestions please and thanks

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

  • 4Vikram

    21

  • JollyBoy

    10

  • mettastar

    4

  • kittaya

    4

Top Posters In This Topic

2 minutes ago, 4Vikram said:

i have a requirement like this..

Select AB, AC, AD, AE FROM Tbl.ABC 

Aite AD lo values are like Alabama, Alaska, Arkansas and so on..

I need to create a view which gets me results like 

IF AD = Alabama then 1 if AD = Alaska then 2 atla continuation and this will be like an added new column AF anukondi.. suggestions please and thanks

I think it is not possible to do this bro .... req change cheyamani cheppu business ki 

Link to comment
Share on other sites

SELECT
   CASE 
    WHEN course_enrollment_settings.base_price = 0      THEN 1
    WHEN course_enrollment_settings.base_price>0 AND  
         course_enrollment_settings.base_price<=100     THEN 2
    WHEN course_enrollment_settings.base_price>100 AND   
         course_enrollment_settings.base_price<201      THEN 3
        ELSE 6
   END AS 'calc_base_price',
   course_enrollment_settings.base_price
FROM
    course_enrollment_settings
WHERE course_enrollment_settings.base_price = 0

apt example

Link to comment
Share on other sites

2 minutes ago, kittaya said:

SELECT
   CASE 
    WHEN course_enrollment_settings.base_price = 0      THEN 1
    WHEN course_enrollment_settings.base_price>0 AND  
         course_enrollment_settings.base_price<=100     THEN 2
    WHEN course_enrollment_settings.base_price>100 AND   
         course_enrollment_settings.base_price<201      THEN 3
        ELSE 6
   END AS 'calc_base_price',
   course_enrollment_settings.base_price
FROM
    course_enrollment_settings
WHERE course_enrollment_settings.base_price = 0

apt example

bhaiyya problem endi ante 47 states unai motham 47 rayala ani?

Link to comment
Share on other sites

8 minutes ago, mettastar said:

case statement rasko

 

4 minutes ago, kittaya said:

+1 

 

4 minutes ago, Picha lite said:

^^

^^

Just now, johnubhai_01 said:

case stmt raasuko.. 

 

andaru chepturu ani chepinav le  johnubhai_01

Link to comment
Share on other sites

1 minute ago, 4Vikram said:

bhaiyya problem endi ante 47 states unai motham 47 rayala ani?

function rasi danini call chesuko statement lo ... rayali mari aekkado oka chota thappadhu

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...