E
E
Evgeny Danilov2015-10-29 20:39:43
MySQL
Evgeny Danilov, 2015-10-29 20:39:43

How to get the desired values ​​from mySQL (connection)?

I need to get data from a database table, according to certain parameters:
I select all tags from one table -

SELECT * FROM prefix_record_tag WHERE tag = 'my tag'

It returns a certain result in the form of columns - ID of the tag, ID of the material to which the tag belongs, tag.
I need to get data from prefix_record_descirption by the "material ID" parameter - all the results that match in the record_id field. How can I do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
coderisimo, 2015-11-02
@danilovevgen

As far as I understand, you need a LEFT JOIN
query like:
SELECT "here are all the fields from the two tables that you need" FROM prefix_record_tag
​​LEFT JOIN prefix_record_descirption ON (prefix_record_tag.material_id = prefix_record_descirption.record_id)
WHERE prefix_record_tag.tag = 'my tag'
is rather pseudo code, but the gist is hopefully. clear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question