How can I get an ordered list of columns values in a row in MySQL?
I have a table that listed six unique numbers in a row, on their specified columns: id n1 n2 n3 n4 n5 n6 1 44 11 32 14 28 19 How I can use MySQL to get the row values…
I have a table that listed six unique numbers in a row, on their specified columns: id n1 n2 n3 n4 n5 n6 1 44 11 32 14 28 19 How I can use MySQL to get the row values…
Under spu_pricebucket there are 5 different pricebuckets. I want to change it so each pricebucket will have its unitprice below it. End goal is to turn this table from 6 columns and 10 rows to 9 columns and 2 rows,…
I have a many to many relationship between Users & Courses with a pivot table, Users_Courses, containing an isComplete value, but i can't seem to retrieve the isComplete value without looping through every user, getting their courses and then looping…
I'm training with many to many relationships and today i'm trying to compare 2 pivot tables. I'm trying a site for a nutritionist. On one hand the nutritionist/admin can create patient's card (my table "User". In this cards he informs…
I am working in Rails and Postgres. I have a table Problems, which has a few columns. I have another table ExtraInfos, which references Problems and has three columns: problem_id, info_type, info_value. For example: Problems: id problem_type problem_group 0 type_x…
Hi all, I have a table as shown in the screenshot above. I wrote a query using CASE statement so that it will return extra columns that I need. Below is the query that I wrote: SELECT *, CASE WHEN…
I have table data after doing all joins and restrictions like this: Name Type Path Item 1 mobile /mobile/image1.jpg Item 1 desktop /desktop/image1.jpg Item 2 mobile /mobile/image2.jpg Item 2 desktop /desktop/image2.jpg I want the result table to look like this…
I have 3 table: tasks, users, group, and a pivot table group_user. A task has user_id, group_id A group_user pivot table has user_id, group_id I want to query the tasks if the task belongs to a group of the user.…
I need to join all the three tables as mentioned below datatype id code 1 Q_1 2 Q_2 3 Q_3 4 Q_4 5 Q_5 6 Q_6 7 Q_7 8 Q_8 9 Q_9 10 Q_10 model id datatype_id values model_ex_id 1…
Product prod_id prod_name 10 Orange 11 Apple 12 Carrot 13 Lettuce Category cat_id cat_name 20 Fruit 21 Vegetable Item item_id property_type property_value 30 fk_prod_id 10 30 fk_cat_id 20 31 fk_prod_id 11 31 fk_cat_id 20 32 fk_prod_id 12 32 fk_cat_id 21…