Most voted "inner-join" questions
58 questions
Sort by count of
-
4
votes1
answer68
viewsDifference between query with and without Inner Join
What is the difference between doing the two queries below, one with and the other without INNER JOIN? What is the most appropriate? SELECT p.Descricao as Produto, c.Descricao as Categoria FROM…
-
3
votes2
answers304
viewsSQL query unifying 3 tables
I have 4 tables that I need to join them in a single query where the result is: nome |COUNT(terrenosDeCadaID)|COUNT(conversasDeCadaID) joao | 2 | 3 maria| 1 | 2 The tables are like this: users…
-
3
votes3
answers97
viewsRelationship between the tables
I have the following tables: TB_ESTOQUE |COD_PRODUTO|QT_DISPONIVEL|COD_FILIAL| | 0856322 | 5 | 41 | | 0856351 | 2 | 41 | | 0856322 | 9 | 114 | | 0856720 | 3 | 20 | | 0856322 | 8 | 128 | | 0856322 |…
-
2
votes1
answer217
viewsSQL JOIN multiple tables
I have 4 tables that I need to extract the results, but I always get duplicate records, someone can help? tabclientes: codcli nome 1 A 2 B 3 C tabrepre: codrepre nome 1 AA 2 AB 3 AC tabvendedor:…
-
2
votes2
answers301
viewsDoubt to use Replace together with Inner Join
I’m using the Inner Join to combine two tables: SELECT eventos.colab_id, colaboradores.setor FROM colaboradores INNER JOIN eventos ON colaboradores.id = eventos.colab_id So far so good, however I…
-
2
votes2
answers515
viewsINNER JOIN in 4 tables
I have 4 tables: TB_OS_MANUTENCAO: TB_OS_ELETRONICA: TB_OS_MECANICA: E TB_OS_INFORMATICA: as shown in the images, all tables have a common field, calledid_, and also with a common value, 8. This…
-
2
votes1
answer363
viewsTypeorm query with Inner Join is coming empty
I made two tables, Usuario 1 : N Produto I made an Inner Join with Typeorm, but an empty array was coming, so I took the query it was generating to analyze it better. When I played the query in…
-
1
votes1
answer40
viewsHow to catch the latest releases of an Inner Join
Staff to making a query in 3 tables with Internet, follow the code: select itensVenda.idVenda, itensVenda.idProd, itensVenda.qtd, produtos.id, produtos.descricao, produtos.foto, venda.id,…
-
1
votes2
answers144
viewsInner Join Sqlite with Cursor on Android
Good morning guys, could you ask me a question ? How should I make one Inner Join in the SQLite using the Cursor ? Below is my code, but I do not know how to fit it in the line. final SQLiteDatabase…
-
1
votes1
answer301
viewsWhy is the id ambiguous even creating an alias?
select deals.id as dealid from funnels inner join deals on deals.funnel_id = funnels.id where id = 3 returns 1052 - Column 'id' in 'Where clause' is ambiguous My database is Mysql. Why there was…
-
1
votes1
answer45
viewsSql using left Join
I have the following tables: TB_ESTOQUE |PRODUTO|QT_DISPONIVEL|COD_FILIAL| |0856322| 5 | 41 | |0856351| 2 | 41 | |0856322| 9 | 114 | |0856720| 3 | 20 | TB_FILIAL |COD_FILIAL|COD_LOCALADM| | 41 | 114…
-
1
votes1
answer424
viewsUPDATE with 2 Joins POSTGRESQL
I would like to ask for help with an update on Posrgresql I need to update the value of a column in a table, but that goes through conditions of 2 tables. I tried the code: update proced_conv set…
-
1
votes1
answer90
viewsInner Join with Where and multiple tables
I am mounting a query, where I need to Join between two tables (because the data will be in the main B but not in the complementary BC) and a third table that necessarily need data, which will…
-
1
votes1
answer363
viewsSELECT INNER JOIN using PHP foreach in Datatable
I’m working on a CRUD using Datatable where it shows me data from 3 related tables where these three tables two are related to one. In case the PHP code is executed to fetch and display the data in…
-
1
votes0
answers341
viewsSQL using Join with subquery
I have the following code: select FACAV_CDMATCOOP,CCCCO_NOCOOPERAD,FACLA_ORIDAVIAR FACLA_QTPESOLOTE, FACLA_QTENTREG1, FACAV_ORCDAVIAR, FACLA_NRLOTE, FACLA_DTYALOJA, FATCR_QTPESOMED from FACAV F…
-
1
votes0
answers88
viewsI’m unable to do INNER JOIN in cakephp
All right, guys? I’m using cakephp to make a system that interacts with some database data from a Wordpress site however every time I try to perform an Inner Join cake query shows me this error:…
-
1
votes1
answer117
viewsMysql query with 3 different criteria within the same table in the DB
I need to create a query Mysql/PHP with 3 different criteria, but within the same BD table. Tabela Negociações (Nome: tbl_neg) ID STS VALOR 1 1 R$23.000,00 2 2 R$60.000,00 3 1 R$10.000,00 4 1…
-
1
votes1
answer32
viewsQuery using Inner Join and left Join data together
I’m making a system with php and mysql to control the input and output of vehicles in a company, so there are two tables, one to record the output information and the other to save the return…
-
1
votes2
answers36
viewsConsult related data without repetition
I need to list all data in the CONTRACT table, but only when in the COMMITMENT table blocker = 1: CONTRATO COMPROMISSO codigos codgerado blocker 3315 1102 2 3317 1105 1 3318 1108 1 3320 3315 2 7726…
-
1
votes1
answer148
viewsInner Join returning duplicate lines
I have a purchase order table, which relates to the products table, The purchase order table can own multiple products, this consultation returns me all the purchase order, which has more than one…
-
1
votes1
answer112
viewsSELECT in two different tables with variables of the same name
I have the following consultation to be made: "SELECT DISTINCT andamento_processual.licenciamento_cod, andamento_processual.inter_simplificada_cod, andamento_processual.inter_pretendida_cod,…
-
1
votes0
answers31
viewsSelect with 2 Inner Join returns no result
I have a relational database that has 3 tables: tb_functionaries, tb_licencas and tb_tipo_licencas, each with their respective primary keys. The tb_licencas table, however, has the keys of the other…
-
1
votes1
answer31
viewsDoubt about SQL
Good afternoon guys, I am learning SQL and I have to do an exercise that is: Select the first and last names of employees and consultants working in the "Financial" department. Turns out I’m trying…
-
1
votes0
answers34
viewsDoubt with JOINS and GROUP BY in an SQL (Access) query
Thanks for your help. I am not very advanced in SQL and I am facing a difficulty here, is the following: SELECT tbl_afs_pregao.numaf, tbl_items_pregao.nomeitem, Sum(tbl_items_af.qtd) AS SomaDeQtd,…
-
1
votes1
answer54
viewsINNER JOIN sql query with GROUP BY
I have a select that is giving error. The idea is the result show five columns (CODPROD, DESCRPROD, CODLOCAL, DESCRLOCAL, STOCK). I’m extracting four tables (TGFEST, TGFPRO, TGFLOC and TGFGRU) and…
-
1
votes1
answer44
viewsHow to select data that depends on other tables that have another key in common?
Hello! I was working on a database project using the SQL language in Mysql Workbench. The setting of my project is a university library where we have the tables: (Bold = PK | Italic = FK)…
-
0
votes1
answer1891
viewsPerform two COUNT with INNER JOIN
When using the SQL below to carry out the count of the number of brokers in a table using INNER JOIN, works perfectly. SQL: SELECT conta.acesso, count(corretor.cod) as num_corr FROM conta INNER JOIN…
-
0
votes1
answer467
viewsHow do I make an INNER JOIN conditional?
I have the following SQL that displays me only properties that have a registered photo, as specified in the lines: INNER JOIN fotos ON imoveis.id = fotos.cod How to display real estate with or…
-
0
votes1
answer32
viewsJoin in four tables using LAMBDA
I’ve been banging my head for two days to join with LAMBDA on these tables. I am creating a SESSION for my user in ASP.NET Core, before passing my object to JSON, I need to JOIN these tables.…
-
0
votes1
answer416
viewsIntersection between same table, auto relationship, mysql with INNER JOIN
Hello, I’m making a facebook clone database. I have two tables, one of users and another friendship. The friendships table is a self relationship of users as shown in the image. This table of…
-
0
votes2
answers413
viewsHow to create a View in SQL Server by unifying all columns of 3 tables?
I have 3 tables with the same columns but with different records of different periods and no Pks. I’d like to unify them into one view to analyze the data, have some command in SQL that helps me in…
-
0
votes2
answers683
viewsIs it possible to use Inner Join in several columns of the same table in a Select?
In the database there are 2 related tables. Collaborators: Events (here makes the input of training time by collaborator): I need to know the total training time of each sector. Select below works,…
-
0
votes0
answers154
viewsUse INNER JOIN with WHERE clauses
Guys, I am reassembling a system before in ASP now in PHP already with database loaded and mounted, but I need to do some filters where I need to fetch data from at least 3 different tables and…
-
0
votes1
answer35
viewsINNER JOIN for more than one field in the same table
I have this structure INNER JOIN that works perfectly for what I needed so far. SELECT categorias.codigo,categorias.categoria,categorias.slug,empresas.cidade FROM categorias INNER JOIN empresas ON…
inner-joinasked 6 years ago Gladison 664 -
0
votes1
answer290
viewsInnerjoin with 3 Mysql tables
I am trying to make a query that when I type the name of a product, return me the sector code and the image associated with that sector but my innerjoin is not working I’m trying to do it like this:…
-
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
answers49
viewsHow to concatenate results from an SQL
I have two tables: Produtos, Eventos and Productsprovents(coming from the many ratio for many of the tables Products and Events): I performed the following SQL to get the event data and products…
-
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
answer123
viewsPOSTGRES: INNER JOIN 1:N with multiple tables. Need to count and display records that were accessed as a list
I need to count table records acesso_registro and show in a list. Schema: acesso_registro +--------------+--------+------------+ |id_tipo_midia |id_midia| data_acesso|…
-
0
votes1
answer132
viewsTable Link - Mysql
I’m setting up a system for the user to register/delete/edit/view courses of the school where I work, I set up all the tables but when I will do a inner join in one of the tables does not give me…
-
0
votes1
answer40
viewsData display problem with INNER JOIN
Good morning, I’m having a little problem in the data display with Inner Join, the query returned ok, but in the table view, instead of playing a row only, he is playing more than one, I would like…
-
0
votes1
answer60
viewsInner Join and sub-query problems
This my query below serves to mount a table with data from multiple tables, however is giving an error: Error Code: 1242. Subquery Returns more than 1 Row 0,000 sec I think and the problem is in…
-
0
votes1
answer63
viewsQUERY ERROR sequelize Association LEFT OUTER JOIN API NODEJS
I have the following SQL command: select u.name_user, a.type_administrator from users u inner join administrators a on u.id_user = a.id_administrator; and I need to turn this into my API into Nodejs…
-
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
votes5
answers97
viewsDoubt with Select using ORDER BY
I’m trying to make a SELECT so that it displays from the second table only the most recent record. I tried to do it using GROUP BY and ORDER BY, but with the GROUP BY mine SELECT does not work, only…
-
0
votes1
answer37
viewsTotalize products through two tables - Mysql
I wish the result of SELECT to return: Product name | Credit | Debit | Balance Badge 076 |10 | 5 | 5 Badge 064 | 20 | 10 | 10 Table: products [product.id / product.name] Table: badges [badges.id /…
-
0
votes0
answers201
viewsInner Join - Allocate vector to R
I am trying to make an inner_join between two tables by a common "state code" column. However, it is giving an error of "allocate vector of size 1.4 Gb". Code: arquivo_antigo_filtrado<-…
-
0
votes0
answers47
viewsMYSQL - Query, Find last values of a database based on the day and time of the record with an Inner Join
good afternoon... I need a help from the noble programmers of this forum to solve a small bug (I say I’m not a programmer, I’m curious). I have 2 databases, the first database is dynamic, it…
-
0
votes2
answers74
viewsMysql - Catch minor record in a 1:N ratio
Good evening, I may have this answer somewhere but I spent all day researching, using various examples and nothing. I have 2 tables, one of products and another with the models being that 1 product…
-
-1
votes1
answer389
viewsHow to make an INNER JOIN in a single table with 3 keys?
I have a table that has the following structure: origem|papel|campo018|campo040|mercado|Master_key| The column Master_key can have two values: 'NY' OR 'MS', I would like to compare the lines where…