Jump to content

oracle sql!


rajprakashraj

Recommended Posts

table A

col1   col2  col3

1        PR       test

1        JNT    test1

2        PR       test3

3        PR       test4

3        JNT     test5

 

i should get only records which have both PR,JNT  for col1

Link to comment
Share on other sites

16 minutes ago, rajprakashraj said:

table A

col1   col2  col3

1        PR       test

1        JNT    test1

2        PR       test3

3        PR       test4

3        JNT     test5

 

i should get only records which have both PR,JNT  for col1

idhi try cheyyi...   syntax errors emanna ravochemo

 

select col1,count(distinct col2) as qual
from table where col2 in ('PR','JNT')
group by col1
having count(distinct col2) >1

Link to comment
Share on other sites

16 minutes ago, rajprakashraj said:

table A

col1   col2  col3

1        PR       test

1        JNT    test1

2        PR       test3

3        PR       test4

3        JNT     test5

 

i should get only records which have both PR,JNT  for col1

 

Just now, Bhai said:

idhi try cheyyi...   syntax errors emanna ravochemo

 

select col1,count(distinct col2) as qual
from table where col2 in ('PR','JNT')
group by col1
having count(distinct col2) >1

oracle lo eppudu cheyyaledu.. hope it will work w/o syntax issues

Link to comment
Share on other sites

1 hour ago, Bhai said:

idhi try cheyyi...   syntax errors emanna ravochemo

 

select col1,count(distinct col2) as qual
from table where col2 in ('PR','JNT')
group by col1
having count(distinct col2) >1

thanks dude..worked

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...