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

Order by Appending #237

Open
adeelmughal4u opened this issue Jul 13, 2018 · 3 comments
Open

Order by Appending #237

adeelmughal4u opened this issue Jul 13, 2018 · 3 comments

Comments

@adeelmughal4u
Copy link

I am trying to use Order by after the following query

$this->remote_jobs->get_many_by($jobs_params);

right now above query result is
SELECT * FROM hm_jobs WHERE company_id = '1' AND user_id = '6'

I want to add order by within this query... how I will do it?

@shayhurley
Copy link

this should work:

$this->remote_jobs->order_by('field_to_order_by', 'ASC')->get_many_by($jobs_params);

@adeelmughal4u
Copy link
Author

Thanks, it works. 👍

How I will use WHERE LIKE clause for fetching records from table based on this WHERE LIKE?

@willpower232
Copy link

It doesn't look like this is implemented currently.

You probably want to copy the order_by function (https://github.com/jamierumbelow/codeigniter-base-model/blob/master/core/MY_Model.php#L747) into a new function for where_like and reference the codeigniter documentation (https://codeigniter.com/user_guide/database/query_builder.html#looking-for-similar-data)

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

3 participants