0
我有三张表Order,Customer,Address。灵活的搜索或使用三个表的sql查询?
我可以知道如何在灵活搜索中加入三张表以找出客户订单的地址(主要/默认地址或次要地址)吗?
注意:主要地址是在客户注册期间创建的地址。
我有三张表Order,Customer,Address。灵活的搜索或使用三个表的sql查询?
我可以知道如何在灵活搜索中加入三张表以找出客户订单的地址(主要/默认地址或次要地址)吗?
注意:主要地址是在客户注册期间创建的地址。
你想要这样的东西吗?
select {order.deliveryAddress} from {Order as order},{Customer as customer} where {order.user}={customer.pk} and {customer.uid} = ?customerID
OR
select {address.pk} from {Order as order},{Customer as customer},{Address as address} where {order.deliveryAddress}={address.pk} and {order.user}={customer.pk} and {customer.uid} = ?customerID
OR
select {order:deliveryAddress} from {Order as order JOIN Customer as customer ON {order:user}={customer:pk}} where {customer:uid} = ?customerID
请一些示例数据和预期产出增加的问题 – GurV
你不应该使用直接的SQL查询,总是在使用的hybris FlexibleSearch ! –