Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merge two tables in one on one rows!!!
Message
 
 
To
23/08/2002 10:00:24
Martin Thibault
Minière Québec Cartier
Port-Cartier, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00692894
Message ID:
00692939
Views:
12
Take a look at Dynamic Crosstab Queries at http://www.sqlmag.com/Articles/Index.cfm?ArticleID=15608

>Hi every body, Is it possible to merge two tables in one with only one SELECT-SQL? The first table is the parent and the second is the children. I want the select SQL return me the result on one row per parent!!!
>
>Example:
>table constructors (parent)                table drivers (children)
>NAME_CONST (fields)                        NAME_CONST, NAME_DRIVER
>----------                                 ----------  -----------
>Ferrari                                    Ferrari     Michael Schumacher
>Williams                                   Ferrari     Rubbens Barrichello
>Bar                                        Williams    Ralph Schumacher
>Renault                                    Williams    Juan Pablo Montoya
>                                           Bar         Jacques Villeneuve
>
>The number of childrens can be different for each parent, i don't know the maximum of childrens, and the minimun can be zero!!!
>
>I would like the result of the SQL select seem like that:
>NAME_CONST          NAME_DRIVER1          NAME_DRIVER2
>----------          ------------          ------------
>Bar                 Jacques Villeneuve    (NULL)
>Ferrari             Michael Schumacher    Rubben Barrichello
>Renault             (NULL)                (NULL)
>Williams            Ralph Schumacher      Juan Pablo Montoya
>
>I works with Sql Server 2000!!!
>
>Thanks!!!
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform