Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Order params #2588

Closed
StarkovPO opened this issue Aug 8, 2023 · 1 comment
Closed

Question about Order params #2588

StarkovPO opened this issue Aug 8, 2023 · 1 comment

Comments

@StarkovPO
Copy link

Hey! I want to use sqlc with huge query where I want to use the order by column_name and asc or desc. Am I able to use sqlc and pass params of order and sort to func?

My sql query = SELECT (CASE WHEN r0_.user1_id = ? THEN CONCAT(COALESCE(u1_.name, 'ZZZZZZZZZZZZ'), u2_.id) ELSE CONCAT(COALESCE(u3_.name, 'ZZZZZZZZZZZZ'), u4_.id) END) AS sclr_0, (CASE WHEN r0_.user1_id = ? THEN CONCAT(COALESCE(u1_.nickname, 'ZZZZZZZZZZZZ'), u2_.id) ELSE CONCAT(COALESCE(u3_.nickname, 'ZZZZZZZZZZZZ'), u4_.id) END) AS sclr_1, r0_.id AS id_2, r0_.status12 AS status12_3, r0_.status21 AS status21_4, r0_.updated AS updated_5, u4_.id AS id_6, u4_.username AS username_7, u4_.password AS password_8, u4_.is_active AS is_active_9, u4_.is_verified AS is_verified_10, u4_.created AS created_11, u4_.updated AS updated_12, u4_.is_anonymous AS is_anonymous_13, u4_.confirmation_code AS confirmation_code_14, u4_.password_reset_token AS password_reset_token_15, u4_.operated_at AS operated_at_16, u2_.id AS id_17, u2_.username AS username_18, u2_.password AS password_19, u2_.is_active AS is_active_20, u2_.is_verified AS is_verified_21, u2_.created AS created_22, u2_.updated AS updated_23, u2_.is_anonymous AS is_anonymous_24, u2_.confirmation_code AS confirmation_code_25, u2_.password_reset_token AS password_reset_token_26, u2_.operated_at AS operated_at_27, u3_.birth_date AS birth_date_28, u3_.external_account_id AS external_account_id_29, u3_.first_name AS first_name_30, u3_.gender AS gender_31, u3_.id AS id_32, u3_.last_name AS last_name_33, u3_.name AS name_34, u3_.nickname AS nickname_35, u3_.picture_url AS picture_url_36, u3_.promo_email_agreement AS promo_email_agreement_37, u3_.connection_information AS connection_information_38, u3_.tag AS tag_39, u1_.birth_date AS birth_date_40, u1_.external_account_id AS external_account_id_41, u1_.first_name AS first_name_42, u1_.gender AS gender_43, u1_.id AS id_44, u1_.last_name AS last_name_45, u1_.name AS name_46, u1_.nickname AS nickname_47, u1_.picture_url AS picture_url_48, u1_.promo_email_agreement AS promo_email_agreement_49, u1_.connection_information AS connection_information_50, u1_.tag AS tag_51, r0_.user1_id AS user1_id_52, r0_.user2_id AS user2_id_53, u4_.login_type AS login_type_54, u4_.project_id AS project_id_55, u4_.profile_id AS profile_id_56, u2_.login_type AS login_type_57, u2_.project_id AS project_id_58, u2_.profile_id AS profile_id_59, u3_.country_id AS country_id_60, u1_.country_id AS country_id_61 FROM relationship r0_ INNER JOIN user u4_ ON r0_.user1_id = u4_.id AND u4_.login_type IN ('xsolla_login', 'proxy', 'social', 'store', 'subscribe', 'playfab', 'firebase', 'server_custom_id', 'phone', 'device', 'email') INNER JOIN user u2_ ON r0_.user2_id = u2_.id AND u2_.login_type IN ('xsolla_login', 'proxy', 'social', 'store', 'subscribe', 'playfab', 'firebase', 'server_custom_id', 'phone', 'device', 'email') INNER JOIN user_profile u3_ ON u4_.profile_id = u3_.id INNER JOIN user_profile u1_ ON u2_.profile_id = u1_.id WHERE (r0_.user1_id = ? AND r0_.status12 = 1) OR (r0_.user2_id = ? AND r0_.status21 = 1) ORDER BY r0_.updated ASC LIMIT 20

is it possible?

@kyleconroy kyleconroy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
@kyleconroy
Copy link
Collaborator

Discussed in #2061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants