Selecting data from the database with Mysql

0

I have a problem because I'm doing a data search in MySQL with a select and a where so for example:

select * from $tabla where categoria = :categoria and ambitos = :ambitos

The problem is when I want to bring all the data and I do not need to use the where , I have a dropdown where the categories are and other areas, but each one would also like to have all of them to bring all the data for example of category and to bring all the data of scopes.

    
asked by Avancini1 20.10.2017 в 15:41
source

1 answer

0

If the tables have similar fields you can make a union and list the results, or use two queries and with php join the results in the same table.

(SELECT a FROM t1 WHERE a=10 AND B=1)
UNION
(SELECT a FROM t2 WHERE a=11 AND B=2)

Review the documentation for mysql

    
answered by 20.10.2017 в 15:50