473,770 Members | 6,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query - Select two tables where a.id=b.id

Hi,

my query is:

SELECT a.symbol_art,b. node_key

FROM artykuly a, art_podz b

WHERE a.symbol_art=b. symbol_art

------------- -------------------

table: artykuly table art_pod

a.symbol_art b.symbol_art

AA-0001 AA-0001 = record ok

AA-0002 NULL = >>>>>>>>I want to view diference
records symbol_art in two tables

How select all a.symbol_art where in table art_podz b.symbol_art is no exists?

tnx.

Tom


Dec 28 '07 #1
2 4221
info (informatyk@fit ness[CUT]authority.pl) writes:
my query is:

SELECT a.symbol_art,b. node_key

FROM artykuly a, art_podz b

WHERE a.symbol_art=b. symbol_art

------------- -------------------

table: artykuly table art_pod

a.symbol_art b.symbol_art

AA-0001 AA-0001 = record ok

AA-0002 NULL = >>>>>>>>I want to view diference
records symbol_art in two tables

How select all a.symbol_art where in table art_podz b.symbol_art is no
exists?
You need to use an outer join:

SELECT a.symbol_art,b. node_key
FROM artykuly a
LEFT JOIN art_podz b ON a.symbol_art=b. symbol_art

With an outer join all rows in the table on the outer side, left here,
are maintained in the result set.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 28 '07 #2
Research information on joins. This includes inner joins, left outer join,
right outer join, full outer join and cross joins

--
Sincerely,
John K
Knowledgy Consulting, LLC
knowledgy.org

Atlanta's Business Intelligence and Data Warehouse Experts
"info" <informatyk@fit ness[CUT]authority.plwro te in message
news:fl******** **@news2.task.g da.pl...
Hi,

my query is:

SELECT a.symbol_art,b. node_key

FROM artykuly a, art_podz b

WHERE a.symbol_art=b. symbol_art

------------- -------------------

table: artykuly table art_pod

a.symbol_art b.symbol_art

AA-0001 AA-0001 = record ok

AA-0002 NULL = >>>>>>>>I want to view
diference records symbol_art in two tables

How select all a.symbol_art where in table art_podz b.symbol_art is no
exists?

tnx.

Tom




Jan 9 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3073
by: Xenophobe | last post by:
I know this isn't a MySQL forum, but my question is related to a PHP project. I have two tables. table1 table2 "table1" contains 2 columns, ID and FirstName:
5
3905
by: Muhd | last post by:
To start off i have a database table that consists of "profiles", another that consists of "users" and finally one that consists of "exclusions", these are defined in the DDL below. I am trying to select all the profiles minus any exclusions that are set up for that user but i keep getting duplicate entries for profiles that aren't excluded and single entries for profiles that are excluded. IF EXISTS(SELECT TABLE_NAME FROM...
5
4490
by: Bernie | last post by:
Greetings, I have 3 servers all running SQL Server 2000 - 8.00.818. Lets call them parent, child1, and child 2. On parent, I create a view called item as follows: CREATE view Item as select * from child1.dbchild1.dbo.Item union all select * from child2.DBChild2.dbo.Item
3
3575
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID from letdata UNION SELECT as ID FROM MEMODATA; I get an ODBC error. The same query runs when the backend files are MDB files and it runs with MYSQL if I only combine 2 tables.
0
1455
by: apb18 | last post by:
A bit of query plan strangeness. Suppose you have an inheritance tree such that the columns 'ID' and 'field' appear in the top level table, call that table XXX. tables YYY and ZZZ both inherit XXX. Now suppose there exists some query that returns a set of IDs that match some criteria (that query may involve various tests/joins/etc on other arbitrary tables). Executing that query alone produces an optimal plan and the exact result set...
21
6982
by: CSN | last post by:
I have a pretty simple select query that joins a table (p) with 125K rows with another table (pc) with almost one million rows: select p.* from product_categories pc inner join products p on pc.product_id = p.id where pc.category_id = $category_id order by p.title
5
321
by: usenet | last post by:
Hi. I've been struggling with a query, so I'm hoping that I can explain it in understandable terms. Given the tables PARENT (id, foo, bar) and CHILD (id, type, parent_id), I would like to select a result (foo, bar, type) where there's "SELECT COUNT(distinct type) FROM child" records for each (foo, bar) combination, ie. type is NULL in the resultset if there's no child of the parent id that has the given (foo, bar) combination. So,...
0
3303
by: phlype.johnson | last post by:
I'm struggling to find the best query from performance point of view and readability for a normalized DB design. To illustrate better my question on whether normalized designs lead to more complex queries yes or no, I have prepared an example. The example is a database with the following tables: *table person with fields: -persid: autoincrement id -name: name of the person *table material with fields: -materialid: autoincrement id
5
3846
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big table, we try separate this big table into twelve tables and create a view
2
9841
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes to open in datasheet view. As an experiment, I deleted all rows in all tables; after that, the query took only seconds to open in both design view and datasheet view. From these facts, I conclude that Access is evaluating the query when I go to...
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8891
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.