2
There’s a database with a name Register and on this bench there are three tables PARENTS, CHILDREN and GRANDCHILDREN:
On the table PARENTS I have two criminal records:
Along with the table CHILDREN:
and the table GRANDCHILDREN
My table GRANDCHILDREN this relates to table CHILDREN for spine idFILHOS and my table CHILDREN is related to table PARENTS for spine idPAIS.
So far I think I’ve done everything right, these initial data are for testing purposes only, but let’s assume that these tables will have thousands of entries and I want to make a query by the name of this person, and in this query bring the family relationship of this person, regardless of the table you are looking for.
Example 1:
I seek to %MATILDE%
MATILDE GONZAGA
E FILHA DE JOSE FIRMINO FRAGA
E NETA DE SEVERINO FIRMINO SILVA
Example 2:
I seek to %MARIA%
MARIA LEITAO GONZAGA
E FILHA DE JOSEFINA MONICA LEITAO
E MAE DE HEITOR DOS ANJOS
# eu também teria que ter uma coluna referente ao sexo
# mas isso não vem ao caso agora
Summarizing: I want to return the "name" field of all related tables resulting from my query.
If it’s not clear, ask me in the comments.
I don’t think your example would fit my code
– user45474
But there’s no code in the question...
– user48732
the name of my DB TABLES AND COLUMNS are all in question mals ae but I am very lay still as you can see I am using phpmyadmin to help me
– user45474
if I mount a query in php with that code works? @jfbueno
– user45474
It should work, it is a valid query. Test in phpMyAdmin to see if it is correct.
– user48732
Mysql returned an empty set (e.g. zero records). (Query took 0.0008 seconds.)
– user45474
The Where was using name
MARIA
instead ofMATILDE
. Already updated the answer, try again. By the way, you should have noticed this.– user48732
now I had feedback but not quite what I am wanting exactly I want to recur same table refente to my primary key
– user45474
Let’s go continue this discussion in chat.
– user45474
let’s assume that and do not know in which table I will find MARIA then I want to make a query in the 'three' tables and recur in the related tables recovering the column name @jfbueno
– user45474
That’s another story, right. Your question has nothing to do with it, at least not directly.
– user48732