Link to home
Start Free TrialLog in
Avatar of TomBalla
TomBallaFlag for United States of America

asked on

Crystal reports XI use table from two databases

I have two databases with some common fields such as stockcode and available quantity.  So I basically want to take 1 table from both databases and compare results.  Is this possible?

The only fields I would look at are stockcode, quantity, and date.
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

If you are connecting directly to the databases and not via a Business oBjects interface then you can select both tables.
Avatar of TomBalla

ASKER

Ok, one problem.  In one table the driver is 103 but in the other table it is 03.  How would I go about saying 03 is equivalent to 103?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I will try that out.
Avatar of Mike McCracken
Mike McCracken

Are you trying to link the tables in the SQL?

mlmcc
I am using SQL, OLE(DB) to get the two databases into database expert.  Then I just attach the two tables needed by common fields.
Is it a 1 to 1 relationship in the 2 databases?

mlmcc
I don't know much about the sql part of making reports.  The two tables match on stockcodes.  The other field I mentioned is the warehouse field, where in one table a warehouse is '03' and in the other table the same warehouse is '103', a 1 is added to the front of the warehouses in that table.

I need these two fields to coexist and I think the report will work fine.
I think you are going to have to use a subreport for one of the tables.

mlmcc
Can you create a linked table or a view in one of the databases that joins the tables?

mlmcc
I was able to link the tables through the stockcode fields and data showed.  I need to get Table A warehouse '03' to be equivalent to Table B warehouse '103'.  

Kind of a If Table A = '03 then add a 1 to the front and compare to table B.  I think I need to make a view but I have never made one.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't have DBA, we are pretty much a 1 person IT squad.

Ok it should look something like this

SELECT '1' & InvWarehouse.Warehouse as Table03Warehouse, InvWarehouse.Stockcode, InvWarehouse.QtyOnHand,  , BTWarehouseHistory.Datetime
FROM InvWarehouse INNER JOIN BTWarehouseHistory ON InvWarehouse = BTWarehouseHistory.WarehouseNo AND InvWarehouse.Stockcode = BTWarehouseHistory.ItemNo

InvWarehouse has no date field it is always the current date.
Do I create a view by going to 'Add command' and putting it in there?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, thanks for the help.