Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Odd conditional join problem Post Reply Post New Topic
Author Message
delstar
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 26
Quote delstar Replybullet Topic: Odd conditional join problem
    Posted: 29 Jun 2009 at 12:34pm
Consider the two tables below :

Model | Make | Color
-------|-------|------
FG1    |   2   | B
SRX    |   1   | Y
GR7    |   3   | G

Index | Code | Value
-------|-------|------
1    |   1   | Ford
1    |   2   | Buick
1    |   3   | Chrysler
2    |   B   | Blue
2    |   G   | Green
2    |   Y   | Yellow

What would be the best way to get the following output :

Model | Make | Color
-------|-------|------
FG1    | Buick | Blue
SRX    | Ford | Yellow
GR7    | Chr.. | Green


I tried to figure it out using SQL (Add Command), but telling it to use the same originating field to populate two different fields depending on the index field has proven to be a bit difficult.

Any ideas?

Sorry for the table formatting (lack thereof). It looked good when I typed it.

Edited by delstar - 29 Jun 2009 at 12:36pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Jun 2009 at 12:44pm
if these are 1 to 1 tables i think you might just be able to add the second table to your report twice. Join table1.make to table2A.code and then add table2 again (table2B) and join table1.color to table2B.code.
YOur final output would be
table1.model / table2A.value / table2B.value
IP IP Logged
delstar
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 26
Quote delstar Replybullet Posted: 29 Jun 2009 at 1:09pm
*bangs head on wall*

I was going down that path, but didn't know how to separate the two fields in the SELECT area. I then realized the JOINed tables could be referenced in that section by their alias.

Thanks
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.