I am using active record. Lets call the model Product. How can i get “select min(price) from tbl_product where name like ‘%hair spray%'” using active record?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use something like this:
You would just need to declare:
public $minprice;in your model class. (Using the above example.)See docs here