Unanswered: Newbie question about concatenating 2 tables
I'm pretty new to databases, but i'm trying to learn
I need to concatenate 2 databases but i don't know how.
the command i have is:
// combobox: switchm_from
$combo_switchm_from = new DataCombo;
$combo_switchm_from->Query = "select indice_puerto, concat(puerto_equipo, ' ', puerto_tipo, ' ', puerto_nombre, ' ',puerto_ip) from puertos order by puerto_equipo ";
$combo_switchm_from->SelectName = "switchm_from";
what i get is:
puerto_equipo is linked to a table named equipos to a field named host_name and i get a number when i need to get a name, example:
1 FastEthernet f0/0 192.168.0.1
1 is the value of the field puertos.puerto_equipo which is linked to equipos.host_name and the contents of the equipos.host_name is 'ccslab1'. FastEthernet, f0/0, 192.168.0.1 are puerto_tipo, puerto_nombre, puerto_ip from puertos table
and i need:
ccslab1 FastEthernet f0/0 192.168.0.1
English is not my primary language and i now very very very little about databases, this code was generated by appgini application so trying to explain maybe a little hard for me so forgive me if the explanation is confuse.
Thanks a lot in advance for any help you can give me
Just in case it helps you understand what i'm trying to do, here are the translations for the caption and/or field names:
indice = index
equipo = equipment
modulo = module
puerto = port
modelo = model
comentario = comments
nombre = name
ubicación = location
tipo = type.
Thank you very much for your help, i've tried to create the sentence with the info you gave me, replacing the field names for the actual fieldnames but i get a syntax error, obviously i'm doing something wrong , i understand the logic but í'm lost about sql syntax, as told before, i generated it using a code generator called appgini, just modified the box adding the concatenat
If you take a look at the last table which is "Puertos SwitchMatrix" which translates SwitchMatrix Ports, then you´ll see at the equipo (equipment) col, a number and not a name, same in the "Vista en detalle" (Detailed View) window at the "Equipo Conectado" (connected equipment) you´ll see something like this:
1 FastEthernet fa0/0 10.96.253.36
where "1" should be ccslab-2600a so what i need is a view like this:
ccslab-2600a FastEthernet fa0/0 10.96.253.36
Where does this number comes from?, from the index number for this record in the equipos table, and what´s recorded in the puertos´s equipo field.
I'll try with the command line you gave me, once again thank you for your invaluable help!!!