Questions tagged as 'join'

1
answer

Problem with join query with 5 tables

Good evening, I'm trying to do a join to 5 tables to get me the information so that it is not returning any data to me. Code SELECT * FROM estabelecimentos INNER JOIN estabelecimentos_anexos ON estabelecimentos_anexos.id_mae = estab...
asked by 24.03.2015 / 23:57
1
answer

Select with Join, in Codeigniter

I'm having a doubt on a select with the use of join in codeigniter, it follows: I have 2 tables. tabela jogo id | id_time1 | id_time2 99 | 1 | 2 tabela time id | time 1 | Real 2 | Barcelona I want to return teams to set up a...
asked by 22.01.2016 / 02:35
1
answer

I need to put a left join to more in this query

My code is below it returns me "h.banco as the bank" with a number, which is foreign key I want it to return the description of this bank, but in many cases, the bank returns me as null How do I mount the from clause to this? I tried t...
asked by 11.11.2015 / 15:42
3
answers

For each value of a table show it corresponds, if it does not show zero

What I want to do is this: Show for each row in the sellers table the number of passes sold, but if you have not sold any passes show 0. It has a previous query in the system that makes it look like, but only shows the sellers that have ticke...
asked by 22.03.2018 / 19:06
1
answer

Select some data from different tables

Rebuilding the programmer here, I'm having trouble with SQL and I'm asking for help. I have two tables called orcamentos and clientes . I need to select all fields from the orcamentos table and only the nome...
asked by 05.04.2017 / 13:37
2
answers

Get data using join in two table 1 for many

Good morning, I need to perform a select of two tables that are related 1 to many: Table 1: Products Table 2: Price group I need to get all prices in the price group table, which can be 1 or more. In my case of the select below it ev...
asked by 20.02.2017 / 15:04
2
answers

I have the id of the state and the city, and now? [closed]

Hello, in a classified site with PHP and MySQL I made through Ajax the insertion of the state and the city. When selecting the state, the id is passed and it sends to the file getcidade.php that makes the select and returns the r...
asked by 24.08.2016 / 03:23
1
answer

Join in three tables does not show all results

SELECT * FROM produto_unidades join produto_notas on produto_notas.id = produto_unidades.produtoNota_id join produto_licitacoes on produto_licitacoes.id = produto_notas.produtoLicitacoes_id where produto_unidades.unidade_id = 2 The join work...
asked by 22.10.2018 / 19:44
1
answer

Left Join Slow in Firebird 2.0

I have two tables: Sale > 100 Records Primary key fields: Invoice Payments > 200,000 Records Primary key fields: Id, Invoice, SalesType, Document. I have the following SQL: Select V.FATURA, P.ID From Venda V Left Join Paga...
asked by 03.10.2018 / 20:32
1
answer

View with two or more unbound tables, with different columns and that need to be merged

I have two tables, "PRIMEIRATABELA" with the fields name, surname, and age, another table "SEGUNDATABELA" with the fields name, last_name, and age both tables has no link but need to join in a view being for example PRIMEIRATABELA.name and SEGUN...
asked by 20.09.2018 / 14:25