INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

pull all rows from two tables with the same field names Crystal 2013

pull all rows from two tables with the same field names Crystal 2013

(OP)
I am trying to pull information from two tables that have the same table structure but different info in each table. (Example: There is 500 address in one table and 350 addresses in a second table and I want to somehow link them and pull all 850 addresses into the crystal report.)

table 1
1230 any time st
2415 los angles st.

table 2
4556 main st
899 2nd st.

Report
1230 any time st
2415 los angels st.
4556 main st
899 2nd st.

RE: pull all rows from two tables with the same field names Crystal 2013

The simplest solution would be to write a command with a union statement that would then in essence merge the corresponding fields from each table, as in:

Select table1.field1, table1.field2, table1.field3
From table1
Where <your selection criteria>
Union
Select table2.field1, table2.field2, table2.field3
From table2
Where <your selection criteria>
Order by 1,2,3


Just make sure you use the same order when specifying fields in each table. This will result in command.field1 containing both field1 fields. If you want to add an order to the command, do it at the end of the entire command, and use ordinal numbers to specify which field(s) to sort by or leave out the line altogether if you wish.

-LB

RE: pull all rows from two tables with the same field names Crystal 2013

Another approach is to apply names to the fields in the SQLL Command, so that would look something like:

SELECT table1.keyfield
,table1.address as home_address
,table2.address as work_address
from table1
join table2 on table1.keyfield = table2.keyfield

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close