Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database design
Message
From
09/08/2011 19:00:52
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01520485
Message ID:
01520556
Views:
30
Still One of the Situations i Gould Be tempted to Code in two steps:
First the Select defaulting to a 0 Discount
Then an update to the correct Discount Value

>Right!
>
>Now I understand the message Access gives. It's seems that in design view, you can only left join one field, and it does tell you to "add " the other one " in your sql statement":), in fact you add it in "sql view".
>
>It works now.
>
>Thanks for this
>
>
>>>This must be a "DBMS 101" classic, but I don't seem to be able to figure it out:
>>>
>>>I have a discount table that has a primary key, a foreign key to customer and a foreign key to the items table. I.e. "some customers have discounts on some items".
>>>
>>>I have an order header table that contains a foreign key to the customer and order detail that has a foreign key to the item.
>>>
>>>I'm trying to build a dbms query or queries (in msaccess) that would join the discount table to the de-normalized order table (I .e. a join of the order header and the order detail on the header key).
>>
>>
>>You have to navigate from the order to the OrderDetail (inner join) , then outer join (there may or may not be a discount) to the discount table using the customer from the order and the item in the OrderDetail
>>
>>
>>
>>select Order.*
>>           OrderDetail .*, 
>>           Discount.Percent 
>>           from Order
>>          join OrderDetail on (OrderDetail.Order_fk = Order.pk )
>>          left join Discount on ( Order.Customer_fk = Discount.Customer_fk ) 
>>                                         and (OrderDetail.Item_fk = Discount.Item_fk )
>>         where ( Order.pk = ?someOrderPK) 
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform