Friday, 15 March 2013

MYSQL request from two tables, in order to display a table -



MYSQL request from two tables, in order to display a table -

i have got mysql database, managed phpmyadmin.

i not clever @ mysql requests.

in table1 (among others) 2 next columns :

- id_product

- active

in table2 (among others) 2 next columns :

- id_product

- description

i would write request display table follows :

having, @ least, id_product column , description column and having product active field equal 1 (the active field can have value of 0 or 1)

thank in advance help in matter.

patrick

you want create inner bring together between tables. matches rows 1 table rows in another, excluding rows don't have match. want add together restriction homecoming active = 1.

this looks like:

select t2.id_product, t2.description table2 t2 inner bring together table1 t1 on t1.id_product = t2.id_product t1.active = 1;

mysql

No comments:

Post a Comment