|
| Re: Help with a join.,.. |
 |
14 Feb 2008 14:50:15 -0700 |
I would use a selectable stored procedure to build the result set you
want.
--
|
| Post Reply
|
| Help with a join.,.. |
 |
Thu, 14 Feb 2008 16:24:08 -050 |
I have 2 tables, basically the same structure....the important fields are
the ones that are named the same.
Table 1
ID, Visit, A,b,c.......
Table 2
ID, Visit, a,g,f.....
I need to combine the two tables in a view(or 3rd table as last resort)
there are limits to what data I need...
For example,
The ID might be in both tables, if so I need the one that the visit is not
NULL
but if the ID is in only one table, take it even if it is null
Can anyone get me started on this one???
Thanks in advance
|
| Post Reply
|
| Re: Help with a join.,.. |
 |
15 Feb 2008 08:28:57 -0700 |
>
> Can you be a little more verbose?
Creat a stored procedure with an output parameter for each field you
want in the result set.
Use a FOR SELECT with a UNION clause to get the unique IDs from both
tables.
FOR SELECT ID FROM TABLE1 UNION SELECT ID FROM TABLE2
INTO :ID
DO...
In the DO block you can select the records for each ID from each table,
decide which values you want in the output and assign those values to
the output parameters.
If you are not familiar with it, read the chapter on stored procedures
in the Data Definition Guide. It should answer most of your questions.
--
|
| Post Reply
|
| Re: Help with a join.,.. |
 |
Fri, 15 Feb 2008 10:00:48 -050 |
"Bill Todd [TeamB]" <no@no.com> wrote in message
news:47b4c5a7$1@newsgroups.borland.com...
> I would use a selectable stored procedure to build the result set you
> want.
Can you be a little more verbose?
|
| Post Reply
|
|
|
|
|
|
|
|
|
|