Join Dissimilar Tables - Reporting

  • Hi All,

     I have two dissimilar tables, what I mean by this is there is no data in either table that has anything to do with the other. Now my problem is I need to create a report that shows the records from both tables. First tables data then right after the second tables data. Is there some way to create a dumby Catagorytype that I could assign to both tables that would only have meaning for me when I fetch the data from tables? Or is their a cleaner way of getting the records from 1st table then the 2nd table records? Now the other restraint is this in Access database.

    JJ

     

     

     

     

  • Well do the tables have the same structure, or does the retrieved information have the same structure?

    Can you make your SELECT statements so that they do return same structured recordsets?

    You could use

    SELECT fieldlist FROM dbo.TableA

    UNION

    SELECT fieldlist FROM dbo.TableB

    If you know that records in TableA will never crop up in TableB then change the UNION to UNION ALL. UNION by itself will bring back DISTINCT records.

    It's been a while since I used Access but their used to be a "SQL Specific" menu option that let you enter UNION queries, DDL and pass-thru queries.

  • No they dont have a similar structure. I have an hours table that needs to show up in crystal reports. I have to do calcs on table to get wages then there is an Accounts table that will need to show up in report as well. So heres hours table layout:

    Hours

    TSDate

    MonHrs

    TuesHrs

    etc..

     

    Accounts

    AcctDate

    AcctDescription

    AcctVal

    What do u think?

     

    JJ

  • Newbie,

    If you are using Crystal have you tried a subreport? The 'Main' report holds the data set of the 1 table and subreport will hold the other data set.

     

    Jake

     

  • Ok I have thought of that but in order to have a subreport don't u have to have a link between the main and subreport? and since I'm using dataset in c# how would I pass a dataset to the subreport? Any ideas?

     

    JJ 

  • Linked subreport(s) are not required. It would be though if you want to share or pass data between main and sub reports. This is accomplished using shared variables, after linking main and subreports.

     I understood your request to be that you had 2 tables without a common link(key) but wanted to show that on 1 physical document(report). Crystal could do that using independent main and subreport. For example, if you want to show a customer aging and a vendor aging on 1 report. This could be accomplished even though there is no link between customers and vendors. However, if there was a link and you wanted to have the Customers Receivables and the Vendor Payables under a common group, you would need a linked subreport.

  • Ah great you just made my day!

    Thanks,

    JJ

     

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply