Jump to content

SQL experts ravali


Recommended Posts

Posted

na sql skills chala goram

Table A

     ID

     authorId

Table B

    ID - Referene key with Table A ID

    Recipentid - Reference key mapped to  TableA author id

    RowId - values (2,6)

Expected result :  Query to find out TableA ID value if there is no records in Table B with rowid values  2 and 6 .,  Table A and Table B join on reference keys Id and authorid

Please help .

Posted
12 minutes ago, KrishnaDevaRaya said:

na sql skills chala goram

Table A

     ID

     authorId

Table B

    ID - Referene key with Table A ID

    Recipentid - Reference key mapped to  TableA author id

    RowId - values (2,6)

Expected result :  Query to find out TableA ID value if there is no records in Table B with rowid values  2 and 6 .,  Table A and Table B join on reference keys Id and authorid

Please help .

Why to join authorid and Receipentid? 

Just not in work avvada?

Select ID from a where Id not in

( select ID from b where rowid in (2,6))

I am not an SQL expert though

Posted

I think you need not exists..

 

select id

from a

where not exists (

select 1

from b

where b.rowid in (2,6)

and b.id = a.id

)

Posted
16 minutes ago, vithanda_vadhi said:

Why to join authorid and Receipentid? 

Just not in work avvada?

Select ID from a where Id not in

( select ID from b where rowid in (2,6))

I am not an SQL expert though

This should work too

Posted
2 hours ago, KrishnaDevaRaya said:

na sql skills chala goram

Table A

     ID

     authorId

Table B

    ID - Referene key with Table A ID

    Recipentid - Reference key mapped to  TableA author id

    RowId - values (2,6)

Expected result :  Query to find out TableA ID value if there is no records in Table B with rowid values  2 and 6 .,  Table A and Table B join on reference keys Id and authorid

Please help .

post these quetsions in stackoveflow dude. Ikkada vesthe pillakaayalu kampu leputharu topic divert chesi.

  • Haha 1
Posted
3 hours ago, ponugupati said:

I think you need not exists..

 

select id

from a

where not exists (

select 1

from b

where b.rowid in (2,6)

and b.id = a.id

)

deeniki not exists, join aasaram ledu.. just not in where clause enough. as suggested by @vithanda_vadhi

Posted

select A.id

Table A left join Table B on a.id=b.ID and a.authorId=b.Recipentid  and b.RowId IN (2,6)

Where b.id is null.

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