0

我正在使用使用 Joomla 框架的 sql 查询,它几乎是在循环结果。

这是语法,它输出的结果几乎是预期的三倍。

->select(array('a.virtuemart_custom_id', 'a.virtuemart_product_id', 'b.virtuemart_custom_id', 'b.value'))
->from('#__virtuemart_product_customfields AS a')
->join('INNER', '#__virtuemart_product_custom_plg_param AS b ON (a.virtuemart_custom_id = b.virtuemart_custom_id)')
->where('a.virtuemart_product_id='.$this->product->virtuemart_product_id)
->order('b.virtuemart_custom_id ASC');

从 phpMyAdmin,它应该只保留 7 个结果。

在此处输入图像描述

我的 SQL 错了吗?为什么输出和循环?

我的结果输出:

数组([0] => stdClass 对象([virtuemart_custom_id] => 38 [virtuemart_product_id] => 20 [value] => |2300cc|)139 [virtuemart_product_id] => 20 [价值] => |4| ) [30] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |2| ) [31] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |4| ) [32] => stdClass Object ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |2 Berth| ) [33] => stdClass Object ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |2| ) [34] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |4| ) [35] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |6 Berth| ) [36] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |2| ) [37] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [value] => |2| ) [38] => stdClass 对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [值] => |4| ) [39] => 标准类对象 ( [virtuemart_custom_id] => 39 [virtuemart_product_id] => 20 [值] => |3| ) [40] => 标准类对象 ( [virtuemart_custom_id] = > 40 [virtuemart_product_id] => 20 [value] => |Coachbuilt| ) [41] => stdClass Object ([virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Low Profile| ) [42] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Coachbuilt| ) [43] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] = > |Coachbuilt| ) [44] => |低调| ) [51] => stdClass Object ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Panel Van| ) [52] => stdClass Object ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [值] => |Coachbuilt| ) [53] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [值] => |Coachbuilt| ) [54] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Panel Van| ) [55] => stdClass Object ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Low Profile| ) [ 56] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Panel Van| ) [57] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [价值] => |低调| ) [58] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Coachbuilt| ) [59] => stdClass 对象 ( [virtuemart_custom_id] => 40 [virtuemart_product_id] => 20 [value] => |Coachbuilt| ) [60] => stdClass Object ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [61] => stdClass Object ( [virtuemart_custom_id] = > 41 [virtuemart_product_id] => 20 [value] => |0| ) [62] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [63] = > stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [64] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [65] => 41 [virtuemart_product_id] => 20 [值] => |0| ) [73] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [74] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [值] => |20994| ) [75] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [值] => |0| ) [76] => stdClass 对象 ( [virtuemart_custom_id] = > 41 [virtuemart_product_id] => 20 [value] => |0| ) [77] => stdClass 对象 ([virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [78] = > stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [79] => stdClass 对象 ( [virtuemart_custom_id] => 41 [virtuemart_product_id] => 20 [value] => |0| ) [80] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [81] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2012)| ) [82] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [83] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [84] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [ value] => |NEW (2012)| ) [85] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [86] => stdClass 对象( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [值] => |新 (2012)| ) [87] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |X111 2233| ) [88] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [89] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [90] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2012)| ) [91] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |YX59 AZL| ) [92] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [value] => |NEW (2013)| ) [93] => stdClass 对象 ( [virtuemart_custom_id] => 42 [virtuemart_product_id] => 20 [价值] => |新 (2013)| ) [94] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [95] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [96] => stdClass Object ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [97] => stdClass Object ( [virtuemart_custom_id] = > 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [98] => stdClass Object ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [99] = > stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [100] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |手册| ) [101] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [102] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [103] => stdClass Object ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [104] => stdClass Object ( [virtuemart_custom_id] = > 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [105] => stdClass Object ([virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual|) [106] = > stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [107] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |手册| ) [108] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [109] => stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [110] => stdClass Object ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [111] => stdClass Object ( [virtuemart_custom_id] = > 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [112] => stdClass Object ([virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual|) [113] = > stdClass 对象 ( [virtuemart_custom_id] => 43 [virtuemart_product_id] => 20 [value] => |Manual| ) [114] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L19' 8| ) [115] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |20'7"| ) [116] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L23'3"| ) [117] => stdClass 对象 ([virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L20'8| ) [118] = > stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L21'7"| ) [119] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value ] => |L25'7| ) [120] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L24'7| ) [121] => stdClass 对象 ( [virtuemart_custom_id ] => 44 [virtuemart_product_id] => 20 [值] => |L22'8| ) [122] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |20'3| ) [123] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] = > 20 [值] => |18'6| ) [124] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L23'4| ) [125] => stdClass对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |20'8| ) [126] => stdClass Object ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L17'9| ) [127] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L23'7| ) [128] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L19'8| ) [129] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |23'7"| ) [130] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L24'7"| ) [131] => stdClass 对象 ([virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [值] => |L17'9| ) [132] = > stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L20'11| ) [133] => stdClass 对象 ( [virtuemart_custom_id] => 44 [virtuemart_product_id] => 20 [value] => |L19'8| ) )

4

0 回答 0