Consider the following table:
+----+----------------+----------------+--------+
| ID | fk_resource_id | fk_language_id | value |
+----+----------------+----------------+--------+
| 1 | 1 | 1 | Entrar |
+----+----------------+----------------+--------+
| 2 | 1 | 2 | Login |
+----+----------------+----------------+--------+
It is necessary to make a select
with filter through columns value
and fk_language_id
:
... WHERE value LIKE '%Ent%'
The result of the above query will be:
+----+----------------+----------------+--------+
| ID | fk_resource_id | fk_language_id | value |
+----+----------------+----------------+--------+
| 1 | 1 | 1 | Entrar |
+----+----------------+----------------+--------+
Notice that the fk_resource_id
column exists. I need to return all records that have the fk_resource_id
field based on the result of the first query.
The result would be as follows:
+----+----------------+----------------+--------+
| ID | fk_resource_id | fk_language_id | value |
+----+----------------+----------------+--------+
| 1 | 1 | 1 | Entrar |
+----+----------------+----------------+--------+
| 2 | 1 | 2 | Login |
+----+----------------+----------------+--------+
I know it's the same result as the initial table, but there are 2 points to consider:
fk_resource_id
, since the search is for the records that have a certain string in the value
column. Update : I do not need to put 2 tables together. You must filter the table by the value
field and, based on the query result, get all the records that have the same fk_resource_id
that results from the first query. Here we have feathers 1 table and INNER JOIN
joins everything in a single row, what I need is new rows, just like the example above.