Questions tagged as 'join'

1
answer

SQL Join multiple tables only the 1st result

I have 3 tables: **clientes** cli_cliente nome 50 A 52 B **telefones_cliente** cli_cliente tel_telefone 50 387 50 386 50 385 52 400 **telefones** tel_telefone tel_contato 3...
asked by 12.07.2018 / 15:31
1
answer

Inner Join with repeated values

Good morning! Can anyone help me with a question? I have a select SELECT * FROM order INNER JOIN kn_status ON (kn_order.n_order = kn_status.fk_order) WHERE kn_order.fk_cliente='$id' The problem is that in the STATUS table the N_ORDER...
asked by 23.05.2018 / 15:08
1
answer

Cross Table in MySql

Does anyone know how to implement a Cross Table in MySql to help me? I need to transform a query that always returns 4 rows of result to only 1 row placing each row field in columns next to each other, as shown in the image below. NOTE: Queue fi...
asked by 20.06.2018 / 00:34
1
answer

I'm having some problems with GROUP BY

I'm having a hard time putting together a select with GROUP BY . What I want to do is this: I have three tables: bicos idbico, idempresa, idbomba abastecimentos idabastec, idbico, idempresa, valora...
asked by 18.05.2018 / 21:20
1
answer

Problem with full outer join doing the filter with where

Friends, I have a database with the following tables: types id | nome 1 | Duplo 2 | Triplo availability data | tipo | ocupado | manutencao | referencia 01/03/2018 | 1 | 1 | 0 | 54684 01/03/2018 | 1 |...
asked by 26.02.2018 / 21:01
1
answer

JOIN between tables with some of them empty

Good Night     I have 6 Tables (A, B, C, D, E, F) A tabela A sempre contém registros e tem uma chave primaria ID The other tables B, C, D, E, and F are all daughters of table A and have an FK_ID column that references the primary key of t...
asked by 14.07.2017 / 01:09
1
answer

Return average cost between partially equal products

As I exemplify in SQL Fiddle , I need to give the tables the data to be returned as follows: / p> nome | descricao| tipo | custo| ult_lancamento | entradas | saidas ---------------------------------------------------------------...
asked by 16.05.2017 / 01:27
2
answers

Update Inner Join (update in two tables) - Php; Mysql

I have two tables and I want to make a join to do an update on both at the same time. Table1: Clipping (id, dia_semana, data) Table2: imagemClipping( id, id_clipping, titulo, dia_semana, data, imagem) The id_clipping is th...
asked by 29.08.2017 / 22:52
1
answer

CodeIgniter update works but wrong list

I'm having a problem updating a bank record by codeigniter, I have two tables, one call: Employee (where employees are stored in the company and in which sector that employee works, this table has the foreign key of the sector table (sector_...
asked by 20.03.2017 / 03:38
1
answer

Select using Join with Distinct

I have two tables: tb_movement | cod | dt_producao | qt_prod | |-----|--------------|---------| | 1 | '04.08.2016' | 10 | | 2 | '04.08.2016' | 5 | | 3 | '09.08.2016' | 12 | | 4 | '10.08.2016' | 3 | tb_ro...
asked by 24.08.2016 / 15:07