Skip to content


DDC-2695: Order by clause left in subquery when using MSSQL and Paginator #3435

doctrinebot opened this Issue · 1 comment

2 participants


Jira issue originally created by user manseuk:

When using the Doctrine paginator and Fetch Join Collections = true and when the original query has an "ORDER BY" clause in it - the subquery created is something like "SELECT DISTINCT FROM (.... ORDER BY ....) as dctrn_result" - when using Microsoft SQL server having the "ORDER BY" clause in a subquery throws an error. This is a similar problem to[DDC-2282]( but that was for the Count Walker - this is for the LimitSubqueryOutputWalker. The fix is the same.


Comment created by manseuk:

Problem still occurs in 2.4 - but different error message,

Query :

SELECT * FROM (SELECT DISTINCT id0, ROW*NUMBER() OVER (ORDER BY c1_.iccid ASC) AS doctrine_rownum FROM (SELECT AS id0, w0_.batch_id AS batch_id1, AS id2, c1_.iccid AS iccid3, AS id4, c2_.msisdn AS msisdn5, AS id6, AS name7, AS id8, AS id9, AS name10, AS id11, w6_.created AS created12, AS id13, w7_.ident AS ident14, AS id15, w8_.ident AS ident16, AS id17, AS id18, c10_.contract_length AS contract_length19, c10_.rental AS rental20, AS id21, w11_.ident AS ident22 FROM workflow_request w0_ WITH (NOLOCK) INNER JOIN core_sim c1_ ON w0_.sim = LEFT JOIN core_connection c2_ ON c1_.active_connection_id = INNER JOIN core_billing_account c3_ ON c1_.billing_account_id = INNER JOIN core_mno_account c4_ ON c1_.mno_account_id = INNER JOIN core_mno c5_ ON c4_.mno_id = INNER JOIN workflow_request_log w6_ ON = w6_.request INNER JOIN workflow_action w7_ ON w0_.action = INNER JOIN workflow_request_status w8_ ON w0_.status = INNER JOIN core_customer_solution c9_ ON w0_.customer_solution = INNER JOIN core_customer_tariff c10_ ON c9_.customer_tariff_id = INNER JOIN workflow_request_action w11_ ON w6_.request_action = WHERE w7_.ident IN (?) AND w8_.ident = ? AND w11_.ident = ?) dctrn_result) AS doctrine_tbl WHERE doctrine*rownum BETWEEN 1 AND 25' with params ["activate", "network", "approved"]

Error :
SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]The multi-part identifier "c1_.iccid" could not be bound.

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.