Mysql – SQL join with pivot
I have a couple of tables i want to join. They are connected through a pivot table. I have a projects table, a employees table and a pivot table called employee_project that has both a project_id and a employee_id: id…
I have a couple of tables i want to join. They are connected through a pivot table. I have a projects table, a employees table and a pivot table called employee_project that has both a project_id and a employee_id: id…
I would like to have a query with a result like below: 1000 2000 3000 or 1 3 5 so on..I want to control results from lists for instance. SELECT 1 — I know that I can use SELECT like…
I have a JSON column that stores an array of objects, each object having 2 properties: [ { "title" : "CALCULATED", "applies" : true }, { "title" : "APPROVED", "applies" : false }, { "title" : "RECIEVED", "applies" : false…
I have two table X & Y: Table X id Value 1 "a,b,c,d" 2 "b,c" 3 "a,c,d" 4 "a,b,c" 5 "a,d" 6 "b,d" Table Y id Filter 1 "a,d" And I want to get join table contain "a" & "d",…
If multiple entries have the same ID (tag_num), I would like the columns to be the same. For example, if one row may have a description and another one is null but both have the same ID(tag_num), I'd like the…
Below is the query: I got this query over internet while searching to sort comma separated values in a single column SELECT id, title, GROUP_CONCAT(aNumber ORDER BY aNumber) FROM ( SELECT id, title, CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(numbers, ',', tens.acnt * 10 + units.acnt…
I have a mysql database and i want to insert values similar to this one 12,3456.78. I tried using the float and double type but the result is rounded to 12 and using decimal is still not helping, i get…
I try to get an amount by joining id and date, but I get an error in the group and the join clause. The expected result is to bring the amount for the max date and lastdate from table 2…
I am using multiple concat with like but I am not getting all the output from the table. I am using below SQL query below in the database. select company_id as ID, concat( c.list_rank, '|||', c.company_name, '|||', c.company_size, '|||', c.industry…
I'm making some adjustments to a docker project with laravel but I'm having the following problem: SQLSTATE[HY000] [1049] Unknown database 'ead'. Which is strange because I have the database created, every time I use the command: php artisan migrate I…