Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Arunavalli
Starting Member
3 Posts |
Posted - 2014-07-31 : 05:20:47
|
I used 2 tables.IT_PO_MASTER IT_PO_PAYMENTCommon field is PONO and fin_year I want to fetch record from IT_PO_MASTER, which record is not present in IT_PO_PAYMENT.I tried below query. It takes value. But it return One record in 86 times ( that is 86 record in IT_PO_PAYMENT table)///Select a.PONO,a.PO_ALLOT,a.NOTENO,a.PODATE,a.POTYPE,a.MASTERPO,a.BRANCH_ITEM,a.PO_AMOUNT,a.BUYBACK,a.REMARKS,a.FIN_YEAR,a.DELETEFLAG from IT_PO_MASTER a, IT_PO_PAYMENT b WHERE a.DELETEFLAG='0'and a.fin_year=b.fin_year and a.pono not in (select po_no from it_po_Payment) order by a.pono ascKindly help me to solve this one. |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-07-31 : 06:08:53
|
if you just want the pono,then try thisselect distinct pono from IT_PO_MASTER where pono not in(select pono from IT_PO_PAYMENT)Javeed Ahmed |
|
|
Arunavalli
Starting Member
3 Posts |
Posted - 2014-07-31 : 06:12:11
|
No Sir. I want to all the fields. Whatever i mentioned in query. |
|
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-07-31 : 06:31:37
|
ok then add the remaining columns to the queryJaveed Ahmed |
|
|
Arunavalli
Starting Member
3 Posts |
Posted - 2014-07-31 : 06:46:36
|
Thank you sir. After using distinct keyword it is work good. |
|
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-07-31 : 06:53:49
|
welcomeJaveed Ahmed |
|
|
|
|
|
|
|