Most voted "join" questions
Use this tag when the question refers to the syntax/behavior doubt of the JOIN command. A JOIN is a general operation in relational algebra for a combination operation on two or more relations in a relational database system; it is also the keyword of the SQL language to perform this operation.
Learn more…290 questions
Sort by count of
-
0
votes2
answers32
viewsI need to do a data conversation of 2 different tables
good afternoon everyone, here me again to ask a question that for many is basic but I really don’t know how to do so come on. I have 2 tables originally in Paradox, I converted both to Firebird to…
-
0
votes1
answer649
viewsSQL De-to joining different data
I have an appointment taking away my patience, I have to join two tables of different years, but the reference codes changed from one year to another. How do I keep information on the same line.…
-
0
votes2
answers2625
viewsInner Join with two keys with python
I have two tables, one for consultation and one for examinations, both with the date of execution and the code of the beneficiary. Want to make a third table with people who have had exams and…
-
0
votes0
answers64
viewsHow to use two Join followed SQL
How can I use two joins in a row, and the second will use the table data generated by the first? I want it to relate the Join by the same data, where in the first Join it unites the data of table A…
-
0
votes1
answer94
viewsInner John and Left John problem
I am using the Postgresql + C database# I have a Type that we can call Main. Inside it I have a long id, string name, I have a Classea, Classeb, Classec. Both the Classea, Classeb, Classec may or…
-
0
votes0
answers51
viewsProblem joining tables in Mysql
I have 3 tables: tb_carne_lancamento AS A tb_partisa_x_recipe AS B tb_plano_accounts AS C In table A and B I have the id of table tb_plano_accounts and both have a value field. I need to create a…
-
0
votes1
answer48
viewsINNER JOIN Horizontal Results
I am sure it is something simple, but I am not succeeding: I will give the example. tb_empresa e tb_contatosdaempresa Each company has up to 8 contacts (Fields: id_company / name / phone / email) I…
-
0
votes1
answer46
views -
0
votes1
answer35
viewsProblem sorting data resulting from Inner Join
Guys, I have a basic question but I’m having a huge difficulty in making an appointment. I have a protocol system in which protocol data is recorded in a table called PROTOCOL and the updates of…
-
0
votes1
answer63
viewsJOIN with two fields in the ON clause with Codeigniter (mysql+php) (MVC)
I am in need of help with Codeigniter. "Fell into my lap" legacy application. Below is an attempt of mine to illustrate the problem, IE, table names and fields are "scenographic". How to make a Join…
-
0
votes1
answer158
viewsSwap subselect with Oin
good morning! I’m sorry if explanation is not totally clear, it’s because I’m starting in SQL. How do I replace subselect with some type of Join? Because subselect takes longer to load. Examples:…
-
0
votes1
answer32
viewsSimulate mysql Join with a php array
Good afternoon, everyone. I have a two-dimensional associative array with the following data: [0] => array ( "numArea" => '74', "quant" => 2 ) [1] => array ( "numArea" => '7', "quant"…
-
0
votes1
answer177
viewsAggregate array of two or more collections in mongodb
Hello, I have two Collections and want to query the two Collections, like the sql "Join". The relation between the Collections is made as follows: medico: [{ medicoId: { type:…
-
0
votes0
answers83
viewsHow to identify left and right table in the execution of multiple Joins in SQL?
I’m trying to understand how to read the execution of multiple INNER Joins. If I do multiple INNER Joins my left table remains the same as the first INNER JOIN or the left table becomes the…
-
0
votes0
answers33
viewsHow to find the increased amount each month?
http://sqlfiddle.com/#! 17/5184a5/3/0 Dice: create table x (id int8 primary key, fk int8, date date, qty int4); insert into x values (292203, 10679, '2019-06-15', 65) ,(300207, 10679, '2019-06-22',…
-
0
votes1
answer54
viewsLeftjoin does not fetch id values - Laravel
I’m using leftJoin to bring data from 2 tables that are linked by a Belongstomany method to my index view. Virtually all data of the two tables appear when I give a dd in my variable, except the $id…
-
0
votes1
answer48
viewsError doing Count on Join
I’m having difficulties in an issue where my codes always go wrong. The question is: Select the customer name and the number of phones they have registered classified in descending order by the…
-
0
votes1
answer73
viewsDoubt with LEFT or INNER JOIN and WHERE SQL Access
all right? So, I have this query here in Access: SELECT tbl_produtos.NomeProduto, tbl_produtos.PrecoVenda, tbl_precos_especiais.PrecoVenda FROM tbl_produtos LEFT JOIN tbl_precos_especiais ON…
-
0
votes1
answer64
viewsCrossing a primary key with 2 foreign keys from the same table?
I was studying some SQL and came across the following problem: I have 2 tables one called Order and another Locations, follow the fields below: ORDER id | data_creation | id_origin | id_destination…
-
0
votes1
answer51
viewsLEFT JOIN with more than one condition in ON - SQL Server
Hi, guys, all right? I’m putting together a query, and I need to do a Join. In this case, the AIV table records have a start date and may or may not have an end date. I want them to cross as…
-
0
votes1
answer38
viewsReturn maximum table value in JOIN - MYSQL
I need to return the last record of a table that is on JOIN of my consultation. But my knowledge is limited and I can’t go on: Table Services: Table situation: Result of my query: My consultation…
-
0
votes3
answers27
viewsINNER JOIN between two SELECT
I can do the INNER JOIN between two SELECT following the structure below? For the idea is to add a few more SELECT /* Select 1 */ SELECT AVG (UR1_Demanda) as UR1_DemandaAVG, DATEPART(dayofyear,…
-
-1
votes1
answer111
viewsHow to make an SQL do the correct property count under certain criteria
I have the following SQL that correctly counts the number of properties: select clientes.id, clientes.nome, clientes.status, clientes.cliente, clientes.tipo, clientes.disponibilidade, imoveis.id,…
-
-1
votes2
answers97
viewsLEFT JOIN com having
If I have to use a grouping that involves a field of my table that is related through LEFT JOIN and need to use HAVING, how would it look? I know that in WHERE I can not put because ignores LEFT and…
-
-1
votes1
answer3120
viewsSQL database structure of a library
I need to write and populate a Mysql database relative to the control of a library. This involves: 3 tables: | publisher | book | author | The 'publisher' table must have: id, name, city, state,…
-
-1
votes2
answers1365
views"ORA-01417: a table may be Outer joined to at Most one other table"
I’m riding a select and I came across the following mistake: ORA-01417: a table may be Outer joined to at Most one other table SELECT A.SEQPESSOA, A.NUMERONF, A.NROEMPRESA, A.SEQPRODUTO,…
-
-1
votes1
answer87
viewsLaravel Mysql - display the amount of records in a Join query
I have the following query: $empresas = DB::table('empresas') ->join('departamentos', 'empresas.id', '=', 'departamentos.empresas_id') ->join('eventos', 'eventos.departamentos_empresas_id',…
-
-1
votes1
answer50
viewsQuery with Left Join considering the most recent records from the auxiliary table
I have two tables: curriculo (cur_codigo,cur_nome) lembrete_envios (lem_codigo,lem_curriculo,lem_data,lem_tipo) The table resume stores candidate ID and candidate name The table reminete_shipments…
-
-1
votes2
answers159
viewsMake Join in table that has two ID in the same column
The scenario is as follows: I have my service order tables and my technicians scheduling tables for each service order. The problem is: In my OS table I have, for example, the protocols "123" and…
-
-1
votes1
answer51
viewsBring result in a row to Join between tables with 1:N relationship
I have the following problem in SQL Server I have the tables CLIENTE and TELEFONE, with a relationship of 1:N among them: CREATE TABLE CLIENTE( CPF CHAR(11) NOT NULL PRIMARY KEY , NOME VARCHAR(500)…
-
-1
votes1
answer67
viewsUpdate with JOIN with 2 tables together with Select
Hello, I’m with the following query to perform in a database but locked in a situation, below follows the query, the error message and then the explanation. Excerpt from the Code USE BDTESTE GO…
-
-1
votes2
answers114
viewsAdvanced Firebird Join - I can’t join the tables I need and sort in the right result
Good evening guys. I’m on a quest that has been depleting my neurons for a week and I still can’t find the solution. In an ERP used by a client, the demand to visualize purchase value vs sale,…
-
-1
votes1
answer49
views -
-1
votes1
answer14
viewsSymfony Leftjoin createQueryBuilder Error
I’m trying to run this query, My relationship is not explicit between Customer and Competitor; I’m getting this error, that I can’t get details of what’s going on, I can’t get the…
-
-1
votes1
answer92
viewsSpecific join between tables
I have two tables customers id razao_social 1 company_1 2 company_2 and tasks id id_client tasks competency 1 1 '101' '032021' 2 1 '102' '032021' 3 2 '101' '032021' When I make one join between…
-
-1
votes1
answer46
viewsIterative link of tables in R
I am studying a topic of networks and need to represent all the connections between a Vertice and those connected to it, directly and indirectly, so I thought to make an iterative link between…
-
-2
votes1
answer31
viewsTables of MYSQL
As the image shows, I have the table adms_unidade where I can already show the units listed, and I have the table adms_equipamentos with various registered equipment. I want to show how many…
-
-2
votes1
answer81
viewsJoin in SQL with two tables - users and cells
I have two tables in my database, one containing all users with id and name and other details, and another table containing all work cells, where tie through the user id who is the leader and who is…
-
-3
votes3
answers3337
viewsINNER JOIN is duplicating record
I have an INNER JOIN that is duplicating records in the view. Because in the database such records are not duplicated. select conta.dominio, conta.id, conta.modelo, imoveis.id, imoveis.cod,…
-
-3
votes1
answer44
viewsPANDAS - PYTHON - FIND DIFFERENT VALUES
Good afternoon to you all! I’m starting some Python studies and to put into practice I’m trying to optimize some routines for my work. In the sector where we work we have the habit of crossing a lot…