Relative Content

Tag Archive for phpmysqllaravel

Merge data with different column names

I have 2 tables and there is data for users. I want to take the data between the specified dates from these 2 tables, add them together if the same user is in the 2 tables, and write them as a single data if not. I made a join operation as follows, but the unionAll method combines the data in the 2 SQL results, but does not collect the same user data. For example, the user with id 1 is recorded in a table as publisher_id and the column name I want to collect is ticket. In the other table, there is a record as user_id and the column name I want to collect is diamonds. If the ticket value is 10 in one table and the diamonds value is 20 in the other table, the result should be 30, but two separate data are coming. How do I do this merging using the paginate management?

Laravel get latest model for each model and group count totals

I’m trying to show a count for each subscription status for my client model in my Laravel project. A client can have many subscription status entries, but I only care about the newest entry of each. my relationship cientSubscriptionStatusLatest takes care of this. There are many statuses.

Laravel : Get data from query order by asc

I need records in specific order.
Order should be asc and not include null data in order.

This one is my query but its getting null record first after that i am getting my other record.