跳至内容

欢迎!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

此问题已终结
作为版主,您可以批准或拒绝该答案。
接受 拒绝
78 查看

Original table view

1. Apply inner join with it

After the INNER JOIN, the some conditions such as state = 1 no longer applies.

Then, table view will be:

The pagination is displayed for an unknown reason despite having only three records.


2. The first step in debugging is to check the INNER JOIN query conditions.

Then refer to the table's field:

Table #__dt_sub_commission (Sales No are unique)


Table #__dt_sub_commission_history (When the commission is co-broke, there will be two records for two agents, making the sales number non-unique.)

The solution is to select the sales no before the INNER JOIN and use DISTINCT on it.

This allows you to INNER JOIN with the other table's non-unique data without affecting the default query logic.

Remark: If you want, you also can select the other field from #__dt_sub_commission_history, such as
->select('DISTINCT e.sales_no, e.commission_type')
select unique sales no and commission_type.

形象
丢弃

您的回复

请大家尽量给个实质性的回答。如果您想回答这个问题或发表评论,只需 使用评论工具。请记住,您可以随时修改您的答案。 - 不用重复回答同样的问题。另外,请不要忘记投票 - 它确实有助于选择最好的问题和答案!

相关帖文 回复 查看 活动
0
2月 25
105
0
2月 25
86
0
1月 25
54
0
1月 25
55
0
3月 25
98