How correctly to make sampling from two tables?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
18 views
There is a table gamefication 5ba3a35548644602163309.png
It had a list of all "tasks" for users.

There is a table customer_gamefication 5ba3a35bc2b08780762936.png
It stores the id of the user who performed some of the tasks.

I need to get all data from table gamefication(All jobs) and enter the match with customer_gamefication for a particular user(customer_id)

I tried to do and all the right output, but the result was other users, although I pointed out WHERE customer_id
5ba3a286b49ed953408777.jpeg
by | 18 views

3 Answers

0 like 0 dislike
I found a solution
SELECT g.id, g.step_id, g.name, cg.customer_id, cg.status, cg.date_added FROM oc_gamefication g LEFT JOIN oc_customer_gamefication cg ON (g.id = cg.gamefication_id AND cg.customer_id = 26854)
by
0 like 0 dislike
Why flat query I'm afraid???
SELECT g.step_id, g.name, cg.status, cg.date_added FROM oc_gamefication g, oc_customer_gamefication cg WHERE g.customer.id = 26854 AND g.id = cg.gamefication_id
by
0 like 0 dislike
select t1.*, t2.* from oc_gamefication t1 inner join t2 on t2 oc_customer_gamefication.gamefication_id = t1.id where t1.customer_id = 11111
by

Related questions

0 like 0 dislike
1 answer
asked May 20, 2019 by barrty
0 like 0 dislike
1 answer
asked Apr 12, 2019 by troodi
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
asked Apr 12, 2019 by artmirarmi
110,608 questions
257,186 answers
0 comments
36,634 users