473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How can i get records from table A which is not in B in sql server. eg A-B

Shafi hashmi
Hi dear i have two table in sql like,
A={123}
B={3}
i want to perform
A-B={12}

i have writeen this qry
SELECT a.code FROM A LEFT INNER JOIN B ON b.code AND a.name='shafi'
Dec 29 '10 #1
2 1397
gpl
152 100+
you are very close, the left join is the answer, but you want to select all the mismatches, that is where there is no b.code -
SELECT a.code FROM A LEFT OUTER JOIN B ON a.code = b.code
where b.code is null
Dec 29 '10 #2
ck9663
2,878 Expert 2GB
If you're just looking for records in A that are not in B, you can also use NOT EXISTS...

Good Luck!!!

~~ CK
Dec 29 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rebecca | last post by:
I have an Access97 front end using ODBC to communicate with an SQLServer 7.0 back end on a different machine. Most of the work I do in the front end uses forms bound to linked tables that reside...
1
by: syedrafey | last post by:
Hello, One of datagrid on my aspx page is not showing records on production server while there are records in database table. I have tested that page on my local machine and it is working fine....
0
by: kenjichanhkg | last post by:
I can't understand why my session data is cleared whenever I insert records to SQL server. I can see that the session is still the same one but my session variables just disappear. Does anyone...
0
by: sam117 | last post by:
Help me ! To choose n any random records in SQL server, how must i do ? Please!!!!!!!!!!! Thanks!
1
by: pchadha20 | last post by:
How to single numeric values from a field in a table which has multiple numeric value in a field of a table.And that table contains thousands of records. Suppose we have a table customer having...
3
by: ebru | last post by:
about insert/delete/update records in mysql server with asp code how can I insert record in mysql database.. I insert into database but if I leave one text box empty, its give me error how can...
1
by: hilal84 | last post by:
Hi, I have a problem on updating some records on sql server 2005. I can update the records in the table apart from some records. Records are added to table by a .net application. When I try to...
0
by: shilpa.vastrad | last post by:
how to calculate rank in selected records in sql server 2000
0
by: ajith3000 | last post by:
hi all,I'm doin a project with vb.net and sql as back end.i have a problem in deleting records from table.see i got a child table roommaintenance and two parent tables deptmaintenance,wardmaintenance...
0
by: patakamuri sai | last post by:
How to display the records from sql server in textboxes by using ASP.Net with c#
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.