PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Query - Select two tables where a.id=b.id
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Query - Select two tables where a.id=b.id

Réponse
 
LinkBack Outils de la discussion
Vieux 28/12/2007, 07h05   #1
info
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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








  Réponse avec citation
Vieux 28/12/2007, 08h33   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Query - Select two tables where a.id=b.id

info (informatyk@fitness[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, esquel@sommarskog.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
  Réponse avec citation
Vieux 09/01/2008, 20h11   #3
Knowledgy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Query - Select two tables where a.id=b.id

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@fitness[CUT]authority.pl> wrote in message
news:fl2785$f5k$1@news2.task.gda.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
>
>
>
>
>
>
>
>



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10392 seconds with 11 queries