0

Hello to everyone i have a databse made up of 5 table, where 4 of the tables are linked to the fifth one by foreign keys.
the tables are as follows.

  1. Client - ClientID, ClientName
  2. Brand - BrandID, BrandName
  3. Currency - CurrencyID, CurrencyType
  4. RegisterShipments - RegShipmentID, ShipmentNo, ConsignmentNo,BDM,HUDINT,PAN

The following table has the above tables linked to it using Foreign Keys:
5. RegisterShipmentNoDetails - ShipmentDetailsID (PK), RegShipmentID(FK),CLinetID(FK),BrandID(FK),CurrencyID(FK), Season

What i would like to do is to be able to retrieve the data depending on shipment number chosen by user, as well as all the data of all the shipments that are present from the corresponding tables and display it in a datagrid.

I have come up with the following Select Statement, but it seem that it is not working as when i run the query in SQL it is giving me an error that Invalid object name 'RegisterShipmentNoDetails'. .

SELECT  Client.*,Brand.*, RegisterShipments.*, Currency.* from RegisterShipmentNoDetails
inner join RegisterShipments on RegisterShipmentNoDetails.RegShipmentID = RegisterShipments.ShipmentNo
inner join Client on RegisterShipmentNoDetails.ClientID = Client.ClientName
inner join Brand on RegisterShipmentNoDetails.BrandID = Brand.BrandName
inner join Currency on RegisterShipmentNoDetails.CurrencyID = Currency.CurrencyType 

Could someone please help me as i think that i might be doing something wrong in the select statement or else using the wrong Join. Thanks for any help.

2
Contributors
2
Replies
13
Views
2 Years
Discussion Span
Last Post by zamm65
0

Hi

Your query is joining ID columns against char columns which is incorrect (although I would have expected a different error than the one you mention). For example, INNER JOIN Client on RegisterShipmentNoDetails.ClientID = Client.ClientName is wrong, it should be RegisterShipmentNoDetails.ClientID = Client.ClientID and so on.

HTH

0

Hi dijeavons will check it out and see what will happen, will let you know if ok or not, thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.