Monday, March 19, 2012

Combine 2 tables

i have 2 tables in a database
one is recording all the fax-in to users, the another is recording all the
fax-out by users.
i wish to combine the tables (by JOIN?) so that the users can see its own
fax-in and fax-out.
After the join, then the new look is TableA.date, TableB.date in 2 column.
How can i make it in one column, say Table.date combining both tables dates.
thanks a lot.
tony> After the join, then the new look is TableA.date, TableB.date in 2 column.
> How can i make it in one column, say Table.date combining both tables
> dates.
What on earth does "combine" mean? Adding? Concatenating? Doing a
datediff? Max?
Please read the following article and come back with a better question:
http://www.aspfaq.com/5006|||"Tony WONG" <x34@.hknet.com> wrote in message
news:Opjt5F98FHA.1292@.tk2msftngp13.phx.gbl...
> i have 2 tables in a database
> one is recording all the fax-in to users, the another is recording
all the
> fax-out by users.
> i wish to combine the tables (by JOIN?) so that the users can see
its own
> fax-in and fax-out.
> After the join, then the new look is TableA.date, TableB.date in 2
column.
> How can i make it in one column, say Table.date combining both
tables dates.
> thanks a lot.
> tony
>
Tony WONG,
SELECT TableA.date
,TableA.[fax-in]
FROM TableA
UNION ALL
SELECT TableB.date
,TableB.[fax-out]
FROM TableB
Untested, but the idea is the right one so far as I can tell from
the available description.
Modify the above as needed.
Sincerely,
Chris O.|||Thanks a lot.
it is what i wish.
"Chris2" <rainofsteel.NOTVALID@.GETRIDOF.luminousrain.com> glsD:FIOdnXOHVqh8GBfenZ
2dnUVZ_sudnZ2d@.comcast.com...
> "Tony WONG" <x34@.hknet.com> wrote in message
> news:Opjt5F98FHA.1292@.tk2msftngp13.phx.gbl...
> all the
> its own
> column.
> tables dates.
> Tony WONG,
> SELECT TableA.date
> ,TableA.[fax-in]
> FROM TableA
> UNION ALL
> SELECT TableB.date
> ,TableB.[fax-out]
> FROM TableB
> Untested, but the idea is the right one so far as I can tell from
> the available description.
> Modify the above as needed.
>
> Sincerely,
> Chris O.
>

No comments:

Post a Comment