🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.databases.mssql-l
Article #185

Need SQL Select Statement Pro's advice !!

#185
From: ProDevelop
Date: Tue, 26 Mar 2002 20:51
45 lines
2670 bytes
 Hi Group,
 does anybody know, if it is possible to build a Select Statement for
following problem ?

Scenario given:

Tab1
ID          Name            State
1            AA                CA
2            BB                CA
3            CC                CA
4            DD                NY
5            EE                 CA


Tab2
ID          Name           Tab1.FK                    Tab3.FK
10          One              1                                 20
11          Two              1                                 21
12          Three            3                                 20
13          Four              5                                 20
14          Five               5                                 21
15          Six                4                                 20


 Tab3
ID          GroupName
20          GROUP_X
21          GROUP_Y


 Result List should show only Rows from Tab1 with State=CA and
using Tab3 Entries dynamic as follow:

ID NAME   GROUP_X    GROUP_Y    STATE
------------------------------------------------------
1  AA          10 One          11 Two          CA
2  BB           (empty)          (empty)          CA
3  CC          12 Three        (empty)          CA
5  EE           13 Four         14 Five           CA
aso.

 Any idea ?

 thx. in advance. Gordon.
Technical Details
Message-ID: <a7qn6c$bq0$07$1@news.t-online.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 104de1,9aeca6a0a34665ea,start
X-Google-Attributes: gid104de1,public
X-Google-Thread: f6611,9aeca6a0a34665ea,start
X-Google-Attributes: gidf6611,public
X-Google-Thread: 11355a,9aeca6a0a34665ea,start
X-Google-Attributes: gid11355a,public
X-Google-ArrivalTime: 2002-03-26 12:55:02 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail
From: "ProDevelop" <ProDevelop@gmx.net>
Newsgroups: bit.databases.mssql-l,bit.listserv.sqlinfo,comp.databases.ms-sqlserver
Subject: Need SQL Select Statement Pro's advice !!
Date: Tue, 26 Mar 2002 21:51:39 +0100
Organization: T-Online
Lines: 49
Message-ID: <a7qn6c$bq0$07$1@news.t-online.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news.t-online.com 1017176076 07 12096 ZU5NTZ9TSMAiHT 020326 20:54:36
X-Complaints-To: abuse@t-online.com
X-Sender: 510082449394-0001@t-dialin.net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000