Jump to content

oracle sql!


Recommended Posts

Posted

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

Posted
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

Posted

select a.* from tableA  A 

join table A  B on a.col1 = b.col1 

where a.col2 = 'PR ' and b.col2 = 'JNT'

 

-- this sql server ki .. mostly same untadi oracle ki.. 

Posted
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

Posted
34 minutes ago, Bhai said:

 

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

bl@st

Posted
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

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