I'm having a problem with a select
in two tables that are returning the value twice.
I have the companies table and table catalogs that are linked by company.id and catalogs.id_enterprise . When I make a select
that has two or more catalogs from the same company, the company appears more than once.
CREATE TABLE IF NOT EXISTS 'tbl_empresa' (
'id' int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY ('id')
)
CREATE TABLE IF NOT EXISTS 'tbl_catalogos' (
'id' int(10) unsigned NOT NULL AUTO_INCREMENT,
'tbl_empresa_id' int(11) NOT NULL,
PRIMARY KEY ('id'),
KEY 'tbl_empresa_id' ('tbl_empresa_id')
)
I need to select all companies that have catalogs. How do I do that? What would the query look like?