There are two tables - defCategories and userCategories . There are no connections between them, they are different. In defCategories two columns are id and defCategory . There userCategories three columns in userCategories — id , user_id and userCategory . How to pull out all categories from defCategories and categories only to a specific user by user_id from userCategories ?
1 - defCategories
id | defCategories | 1 | Sport | 2 | Programming | 3 | Animals | 2 - userCategories
id | user_id | userCategory 1 | 1 | Work 2 | 7 | Home 3 | 3 | Other 4 | 20 | Food At the exit, I would like to get all the records from defCategories and the records of a specific user from userCategories one request.
3 - Result (Expected Result)
| defCategories | userCategory | Sport | Work | Programming | Home | Animals | Other | | Food Approximately in this form.
| |is a new line.)| Sport | Work | | Sport | Home | | Sport | Other | | Sport | Food | | Programming | Work | | Programming | Home | | Programming | Other | | Programming | Food || Sport | Work | | Sport | Home | | Sport | Other | | Sport | Food | | Programming | Work | | Programming | Home | | Programming | Other | | Programming | Food |etc .. - Tsyklopselect NULL as defCategories, userCategory from userCategories union select defCategories, NULL from defCategoriesthough the records will be strictly separate lines, in one line Sport | Work will not be. And what would you like right here ... you can of course do it, believe me, it’s not worth it, the request will be spooky - Mike