Im struggling with this and tried different groupby options with no success. This is my table And im trying to select max date for each record with ...
Im struggling with this and tried different groupby options with no success. This is my table And im trying to select max date for each record with ...
I need to be able to convert a hasMany() relation, which queries and return an array into a hasOne() relation which returns object|null. Use case: ...
In Yii2, am I able to include two models (active records) in one search model and display them in a gridview? For example, I have two tables, "custom ...
I would like to convert the active record query of yii2 to raw SQL equivalent to check if the query is working correctly or not. It is easy to conver ...
How do I handle multiple inverse relations pointing to the same active record? For example: class Bicycle extends ActiveRecord { public function ...
Am trying to return users with paycheck and loggedout at a certain time and return 10 items per each page but it fails to work I have tried with the ...
Take the following sample Cart model. It has a CartItem "pivot record/table" which links it to Item. class Cart extends ActiveRecord { public fu ...
I have a view in my schema that lists the staff information. I want to calculate the RETIRE_DATE from these two fields: BIRTH_DATE and RETIRE_AGE. U ...
I am getting my dataProvider from which I try to remove some models that don't meet the wanted criteria. This filter is not SQL related and therefore ...
I'm working with Yii2 and using ActiveRecords. I am trying find ethnic distribution in a department. I have a query that groups the staff into their t ...
I have a AieDetail model as below: I have this query that I want to use to select distinct COL_ABBREV column on Department table The value of $a ...
I would like to add a groupby with cacluations in yii2 ActiveDataProvider. SO currently i have the following fields in my database SO i would like ...
Am trying to combine data from different queries into a single active record for the purpose of pagination I have two different databases with simila ...
Hi iam trying to covert this query as active record format code which i have tried this will fails ...
I just read How to query the string field value length in MongoDB and successfully got a query working when used directly in MongoDB console. The quer ...
I am building an app, where an account can have many services, all the information is related to a service. In example: Account A has 3 services and ...
I have 2 simple models: I am trying to get a list of pages and filter them by page_type_id, so i am doing: But I am getting the following error: ...
I have upload my YII2 project to ubuntu 16.04. My source is no problem when run on localhost on my computer, but when I run it on the server ubuntu 16 ...
I use this for query not in: Error: Undefined offset: 1 Failed to prepare SQL: SELECT * FROM usertype WHERE user_type_id NOT IN :qp0 also tried ...