0
I need to do a search for my site in which I returned first the companies that have something similar to typed and, right below, show all registered products with something similar to typed.
I have two tables:
tbl_empresas
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(100) NOT NULL,
`descricao` longtext,
`imagem` varchar(255) DEFAULT NULL,
`data_cadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
and
tbl_produtos
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(70) NOT NULL,
`descricao` longtext,
`aplicacao` varchar(255) DEFAULT NULL,
`imagem` varchar(255) DEFAULT NULL,
`codigo_original` varchar(50) NOT NULL,
`data_cadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`tbl_categoria_id` varchar(11) NOT NULL,
`tbl_empresa_id` varchar(11) NOT NULL,
PRIMARY KEY (`id`)
I tried to perform a survey using JOIN, but it would return me the two tables together, so I could not separate what is product and what is company in the survey visualization.
I wanted my research to show the companies first, then the products (without relationship) and it was possible to make a pagination later.
That would be possible?
If so, how would I need to do?
Select from the company table and then use UNION with select from the product table would help you?
– Rafael Cabral
I hadn’t tried UNION, I’ll take a test here
– Lucas