Jump to content

Sql Exfarts Ravali


nenu_devudni

Recommended Posts

Ok. correct gane undi

 

silk1, mutton1, keema1, 1

silk2, mutton2, keema2, 2

 

ee 2 vachinapudu, you're getting both outside, silk1 okkate kavali antunnavu. Oracle lo least ane function undi. sql server lo ala unte, adi teesukoni cheyi

least kuda try sesinay .. malla 2 atlane ochinay .. bye1 em seyal nen ipud 

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  • nenu_devudni

    22

  • mettastar

    8

  • 4Vikram

    7

  • andhravodu

    7

Top Posters In This Topic

select siken,
       mutton,
       keema,
       goat_curry
  from (select siken,
               mutton,
               keema,
      CASE WHEN goat = 'Average' then 1
           when goat = 'Tasty' then 2
           when goat = 'Bokkalaundi' then 3
      END goat_curry
       from biskit,cream_biskit, salt_bisket
      where blah = blah
        and bluh = bluh)
  where goat_curry=2

 

tasty only vasthadi ipudu

Link to comment
Share on other sites

le roju eda ne unay ... kani musugu lo tirugutunay .. bye1 upto date post lu kuda sustunay .. nevi sana funny ga post lu unay ... em kaval ee neku seppe sesdam


Naak Sandrakala kaval pamp no
Link to comment
Share on other sites

Naak Sandrakala kaval pamp no

etla unai thatha nu .. pelli petakul lev neku .. epudu aina ma uri ki osse seppa rad .. sandrakala endi dan akkai degara kuda podam  .. bye1

Link to comment
Share on other sites

select siken,
       mutton,
       keema,
       MIN(goat_curry)
  from (select siken,
               mutton,
               keema,
      CASE WHEN goat = 'Average' then 1
           when goat = 'Tasty' then 2
           when goat = 'Bokkalaundi' then 3
      END goat_curry
       from biskit,cream_biskit, salt_bisket
      where blah = blah
        and bluh = bluh)
     group by siken,
                   mutton,
                   keema;

 

 

esonti query run sesse .. oke record ravali nak matram rendu ossunay .. fix etla seyal seppandi kasta ..

 

Cropped%20Brahmi%20shock.gif?1350345175

 

2 ways.. let me know if it works or not...

 

1)/***************** 1 *************/

SELECT siken, mutton, keema, MIN(goat_curry) AS Distinct_count

  FROM (SELECT siken,  mutton, keema,

               CASE WHEN goat = 'Average' THEN 1

                    WHEN goat = 'Tasty'   THEN 2

                    WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

          FROM biskit,cream_biskit, salt_bisket

         WHERE blah = blah

           AND bluh = bluh)

      GROUP BY siken, mutton, keema

   HAVING Distinct_count = 1;

 

2)/***************** 2 *************/ 

SELECT siken, mutton, keema 

  FROM (SELECT siken, mutton, keema,  ROW_NUMBER() OVER(PARTITION BY goat_curry ORDER BY goat_curry) AS Distinct_count

          FROM (SELECT siken,  mutton, keema,

                       CASE WHEN goat = 'Average' THEN 1

                            WHEN goat = 'Tasty' THEN 2

                            WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

                  FROM biskit,cream_biskit, salt_bisket

                 WHERE blah = blah

                   AND bluh = bluh  ) 

)

 WHERE  Distinct_count = 1;

Link to comment
Share on other sites

2 ways.. let me know if it works or not...

 

1)/***************** 1 *************/

SELECT siken, mutton, keema, MIN(goat_curry) AS Distinct_count

  FROM (SELECT siken,  mutton, keema,

               CASE WHEN goat = 'Average' THEN 1

                    WHEN goat = 'Tasty'   THEN 2

                    WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

          FROM biskit,cream_biskit, salt_bisket

         WHERE blah = blah

           AND bluh = bluh)

      GROUP BY siken, mutton, keema

   HAVING Distinct_count = 1;

 

2)/***************** 2 *************/ 

SELECT siken, mutton, keema 

  FROM (SELECT siken, mutton, keema,  ROW_NUMBER() OVER(PARTITION BY goat_curry ORDER BY goat_curry) AS Distinct_count

          FROM (SELECT siken,  mutton, keema,

                       CASE WHEN goat = 'Average' THEN 1

                            WHEN goat = 'Tasty' THEN 2

                            WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

                  FROM biskit,cream_biskit, salt_bisket

                 WHERE blah = blah

                   AND bluh = bluh  ) 

)

 WHERE  Distinct_count = 1;

RENDU try chesinay vuncle ... dstinct_count invalid antundi bye1

Link to comment
Share on other sites

2 ways.. let me know if it works or not...

 

1)/***************** 1 *************/

SELECT siken, mutton, keema, MIN(goat_curry) AS Distinct_count

  FROM (SELECT siken,  mutton, keema,

               CASE WHEN goat = 'Average' THEN 1

                    WHEN goat = 'Tasty'   THEN 2

                    WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

          FROM biskit,cream_biskit, salt_bisket

         WHERE blah = blah

           AND bluh = bluh)

      GROUP BY siken, mutton, keema

   HAVING Distinct_count = 1;

 

2)/***************** 2 *************/ 

SELECT siken, mutton, keema 

  FROM (SELECT siken, mutton, keema,  ROW_NUMBER() OVER(PARTITION BY goat_curry ORDER BY goat_curry) AS Distinct_count

          FROM (SELECT siken,  mutton, keema,

                       CASE WHEN goat = 'Average' THEN 1

                            WHEN goat = 'Tasty' THEN 2

                            WHEN goat = 'Bokkalaundi' THEN 3 

  END goat_curry

                  FROM biskit,cream_biskit, salt_bisket

                 WHERE blah = blah

                   AND bluh = bluh  ) 

)

 WHERE  Distinct_count = 1;

 

for 2nd case, imagine

 

a, b, c, 1

d, e, f, 1

 

returns both rows in that case

Link to comment
Share on other sites

RENDU try chesinay vuncle ... dstinct_count invalid antundi bye1

outer query lo where clause petti neku edi kavalo adi select chesko.. u dont have to group in outer query

Link to comment
Share on other sites

select siken,
       mutton,
       keema,
       goat_curry
  from (select siken,
               mutton,
               keema,
      CASE WHEN goat = 'Average' then 1
           when goat = 'Tasty' then 2
           when goat = 'Bokkalaundi' then 3
      END goat_curry
       from biskit,cream_biskit, salt_bisket
      where blah = blah
        and bluh = bluh)
  where goat_curry=2

 

tasty only vasthadi ipudu

atla hard codes seste ostadi kani thapu kada vuncle  bye1 manaki 1 lekapothe 2 teskoval ..2 lekapothe 3 return seyal .. 

Link to comment
Share on other sites

for 2nd case, imagine

 

a, b, c, 1

d, e, f, 1

 

returns both rows in that case

manodi req is not clear man.. he just asking for tasty goat curry bot not mentioning other criteria... 

Link to comment
Share on other sites

 

check this out

 

select * from

(

select siken,
       mutton,
       keema,
       MIN(goat_curry) col4
  from (select siken,
               mutton,
               keema,
      CASE WHEN goat = 'Average' then 1
           when goat = 'Tasty' then 2
           when goat = 'Bokkalaundi' then 3
      END goat_curry
       from biskit,cream_biskit, salt_bisket
      where blah = blah
        and bluh = bluh)
     group by siken,
                   mutton,
                   keema

order by MIN(goat_curry)

)

where rownum <= 1;

 

 

 

 

 

Link to comment
Share on other sites

with GoatCurry as  (select siken,
               mutton,
               keema,
      CASE WHEN goat = 'Average' then 1
           when goat = 'Tasty' then 2
           when goat = 'Bokkalaundi' then 3
      END goat_curry
       from biskit,cream_biskit, salt_bisket
      where blah = blah
        and bluh = bluh)
 

select siken,

       mutton,
       keema,
       goat_curry
  from GoatCurry where goat_curry = (select min(goat_curry) from GoatCurry )

Link to comment
Share on other sites

manodi req is not clear man.. he just asking for tasty goat curry bot not mentioning other criteria... 

vuncle .. 1 - tasty , 2 - average , 3 - bokaklaundi .

 

prioritize seyal .. 1 main priority ... lekapothe 2 .. then 2 lekapothe 3 . .. bye1

Link to comment
Share on other sites

vuncle .. 1 - tasty , 2 - average , 3 - bokaklaundi .

 

prioritize seyal .. 1 main priority ... lekapothe 2 .. then 2 lekapothe 3 . .. bye1

paina query try cheyi bro

Link to comment
Share on other sites

×
×
  • Create New...