Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Glenn — — source: Informix-list mailing list archive (1991-1998)
I'm trying to create a view with descriptions for ID's taken from another
table.
e.g. -- Products Table with multiple PART ID's where PART_DESC
is stored in Parts Table
Products Table:
PROD_ ID PART1_ID PART2_ID PART3_ID
1 34 45 56
Parts Table
PART_ID PART_DESC
34 Widget
45 Digit
56 Gidget
I can use a union to return 3 rows:
PROD_ID PART_DESC
1 Widget
1 Digit
1 Gidget
How can I join PRODUCTS and PARTS tables to return a single row per product?
PROD_ID PART1_DESC PART2_DESC PART3_DESC
1 Widget Digit Gidget
I've tried some combinations of aliases and joins with no success yet
Of course there might be NULLs in any of the Part IDs above PART1_ID
The query should be ANSI-SQL compliant, if possible, for future portability.
I hope it's not a problem with database design, though I'd appreciate it being
pointed out if that's the case, since it's not too late to change it.
Thanks for the help.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.