Group by Parent With same one Child Records and Muiltple Child

Problem with Formatting please find attachment

Basically i have three Tables

Request ID   Parent ID   Account Name   Addresss 
1452         1254789     Wendy's        Atlanta Georgia 
1453         1254789     Wendy's        Norcross Georgia
1456         1254789     Waffle House   Atlanta Georgia

Bid_ID       Bid_Type    Bid_Volume   Bid_V   Bid_D  Bid_E  Request_ID  Parent ID                 
45897        Incentive    10           N/A     N/A    N/A    1452        1254789
45898        Incentive    10           N/A     N/A    N/A    1453        1254789
45899        Incentive    10           N/A     N/A    N/A    1456        1254789

Bid_Number     Bid_Name    Request_ID  Parent ID
Q789456       Wendy'Off     1452       1254789
Q789457       Wendy'Reba    1452       1254789
Q789456       Wendy'Off     1453       1254789
Q789457       Wendy'Reba    1453       1254789
Q789456       Wendy'Off     1456       1254789

I want the Result

Parent ID   Bid_Type    Bid_Volume   Bid_V   Bid_D  Bid_E  AutoGeneratedCol
            Incentive    10           N/A     N/A    N/A    1
            Incentive    10           N/A     N/A    N/A    2
Bid Number  AutoGeneratedCol_Link
Q789456       1
Q789457       1 
Q789456       2
Request ID  AutoGeneratedCol_Link
1452          1
1453          1
1456          2
sql question.txt (1.3 kB)
more ▼

asked Jul 25 at 07:15 PM in Default

chethanmalur gravatar image

1 1

Can you at least explain the logic or rules on how to obtain the required result ?
Jul 26 at 01:58 AM Squirrel
edited question to correct formatting
Jul 26 at 09:42 AM Dave_Green ♦
you should post the schema or table definition. Help people get your relational model.
Jul 28 at 09:44 PM virtualjosh
(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jul 25 at 07:15 PM

Seen: 184 times

Last Updated: Jul 28 at 09:44 PM