473,407 Members | 2,315 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,407 software developers and data experts.

Need help on query

1
TableName: Table1
T1 Field1 Field2
Rows: 1 A
2 B
3 C
4 C
TableName: Table2
Field1 Field2
Rows: 1 A
2 C
3 D

Output
Field1 Table1.Field2 Table2.Field2
2 B C
3 C D

Basically, I would like to display rows which are matching table1.field1 = table2.field1 and not matching table1.field2 = table2.field2
Sep 6 '10 #1
1 936
TheSmileyCoder
2,322 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.Field1, Table1.Field2, Table2.Field1, Table2.Field2
  2. FROM Table1 INNER JOIN Table2 ON (Table1.Field1 = Table2.Field1) AND (Table1.Field2 <> Table2.Field2);
  3.  
Its pretty much as simple as you describe it in wording, its just a matter of converting it into SQL syntax. Note that you cannot write this query in the Query GUI window, you will have to switch to direct SQL view mode, and write it.
Sep 6 '10 #2

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

Similar topics

1
by: Rama S | last post by:
Hi, We need a query which retrieves option_code, for a plan from OPTION table which are unique in (market, "ALL"). I have an example below PLAN MARKET OPTION_CODE RATE...
0
by: PenBlast | last post by:
I need a SQL query that will return row1 and 2. The rule would be "2 (and only 2) occurences of Store_Number where Forms_Count is not the same. Store_Number Forms_count 3 5 3 ...
1
by: bmoos1 | last post by:
I need to make a Report of all people starting in 2004 by "Date Requested". Dates are entered as mm/dd/yyyy. I have a query that has all the people that started in 2004, but there are numerous...
1
by: write2ashokkumar | last post by:
hi.. i have query like this.. select id,name from tbl where id in(5,2,4,1,3); When i execute the above query.. i get the result set with ascending order by id by default....
2
by: jennk | last post by:
i am working in Access 97, our database tables are linked from ODBCsqlsvr (not even sure what that means). i have a table where each record has a unique customer and their order information. there...
2
by: Terry Olsen | last post by:
I have two tables each with one column of serial numbers. I need a query that will return only the serial numbers from Table1 that aren't in Table2. I need it to also return the serial numbers from...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: ----------------
1
by: karuppiah | last post by:
Hi All, i need query,how to select last 3 month ,last 3wek,last 3 days , this last 3 month and 3 week should be friday, using sysdate from dual table, there is no exsting table, pls any one help...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.