Questions tagged as 'join'

1
answer

JOIN 3 different tables display list

Good morning. I'm trying to joke 3 tables and display in a list, but I'm not getting it. I've drawn (with LESS LINES) the tables in the database and an idea of how I'm trying to list the fields. IthinkthatforthisIshoulddo3joins,butitisnotw...
asked by 02.05.2015 / 18:07
2
answers

Join in array creating elements?

We can imagine the following array : var arr = ["a", "b", "c", "d"]; I know I can use join(", ") to make it into a string type: "a, b, c, d" , but I would like to create an element for each array item, which would be type...
asked by 26.07.2018 / 18:06
1
answer

Inner Join with Where and multiple tables

I'm setting up a query, where I need to join between two tables (since the data will be in the main B but not in the BC complement) and a third table that I need the data, which will always be in the main table B. I tried as below, but return...
asked by 05.11.2018 / 20:53
3
answers

How to create a table (empty) from a selection of other tables?

EXAMPLE : I have two tables: table1 : with two columns product_id , product_name ; table2 : With three columns tag_name , product_id , tag_name I would like to create a table3 from a selection of table1 and table2 with...
asked by 09.12.2016 / 13:58
2
answers

Query with JOIN in 3 tables

I have the following tables: livroautor id idautor idlivro ------ ------- --------- 1 1 (NULL) 2 2 2 3 3 3 4 4 4 5...
asked by 08.08.2017 / 00:02
3
answers

Repeat LEFT JOIN with other parameters in the same query

I have 2 tables: FATHER: id nome Child: id idpai sexo_filho I wanted to do a SELECT that sums up the amount of children man and women, that's the problem, I can only do with one of the sex: SELECT pai.nome, count(distinct filho.id...
asked by 02.10.2015 / 21:19
1
answer

Linking of SQL tables by means of string instead of id

User accounts data id nome sobrenome pais estado cidade telefone url_perfil User login data id email senha prioridade My questions are: How can I bind them to foreign key using string ? Is it best...
asked by 24.02.2017 / 13:50
2
answers

SQL Left Join - smaller date greater than current date

3 tables: Processo , Evento , Alerta The goal is to make a query that returns all processes by adding the columns of the event type and date of the most recent event MAX(DataEvento) and the next alert (smaller date g...
asked by 25.05.2018 / 01:50
2
answers

mysql_num_row with inner join

I have 2 tables: Leads Stores The relationship is as follows: 1 shop - > N leads I need to list the number of leads registered for each store and then sort by descending order to know which store has the most leads The i...
asked by 26.04.2018 / 00:57
2
answers

INNER JOIN in the same table

SELECT Agendamento.E3TimeStamp AS Data,Agendamento.Lote, Produtos_values.name as NomeProduto, Produtos_ValueData.TemplateID AS mp_produto FROM produtos_values inner join produtos_valuedata on produtos_values.id = produtos_valuedata.valueid,ag...
asked by 12.07.2017 / 16:36