Collect same ids in Laravel Blade pivot table
I have a pivot table with two foreign keys and I want to list items according to one foreign key. id | tool_id | user_id ______________________ 1 2 12 2 5 12 3 3 12 4 4 7 I have…
I have a pivot table with two foreign keys and I want to list items according to one foreign key. id | tool_id | user_id ______________________ 1 2 12 2 5 12 3 3 12 4 4 7 I have…
I have a table with the following structure: name | version | processed | processing | updated | ref_time ------+---------+-----------+------------+----------+---------- abc | 1 | t | f | 27794395 | 27794160 def | 1 | t | f | 27794395…
I log the daily produced energy of my solar panels. Now I want to create a SQL statement to get the sum of produced energy for each month but separate columns for each year. I came up with the following…
I am using PostgreSQL 9.5 I have two table: A ID | isStatusA | IsStatusB | IsStatusC 0 | true | false | true A table has only 1 row for data i need. Also i have B table with:…
I have a table with position (junior, senior), salary, and an ID. I have done the following to find the highest salary for each position. SELECT position, MAX(salary) FROM candidates GROUP BY position; What I am getting: How I want…
Input should be as below: company sales amazon 100 flipkart 900 ebay 890 amazon 100 flipkart 100 ebay 10 amazon 100 flipkart 90 ebay 10 And expected output should be as below: amazon flipkart ebay 300 1090 910 Tried using…
I've got a simple table that has a column called Date and it stores '2015-01-15' data as an example, it ranges in '####-##-##' and there's multiple of the same dates, but following it is a number called Amount with values…
I would like to construct a query to map products and their associated pictures to match a target database schema. My source database stores SEO URLs for each Product in a Picture table using Product_Picture_Mapping as a two-way mapping table.…