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
votes0
answers94
viewsTime Out When trying to run query in Mysql
I’m running the following code: SELECT e.*, e.CO_ESCOLA, es.CO_ENTIDADE FROM enem20162 e INNER JOIN escolas es ON e.CO_ESCOLA = es.CO_ENTIDADE #WHERE CO_ENTIDADE = ORDER BY e.CO_ESCOLA; I want to…
-
0
votes1
answer609
viewsConvert SQL query to Query Builder (Orange)
I would like to convert the following query SQL to Query Builder (Laravel): $duels = DB::select('SELECT r.id, r.name FROM tournaments t INNER JOIN duels d ON t.id = d.tournament_id INNER JOIN riders…
-
0
votes2
answers617
viewsI have the status and city ID, and now what?
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 is passed the id and it sends to the file getcity.php that makes…
-
0
votes1
answer2205
viewsSelect 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 |…
-
0
votes1
answer63
viewsPrint a line of a two-dimensional array in Perl
I have an array @data, two-dimensional, and I want to record line after line in a file. I’m doing so, for each line $i: print (ECR $data[$i][0]); for $j (1 .. $lastcol) { print (ECR "," .…
-
0
votes1
answer425
viewsIs there a difference in performance between INNER JOIN and CROSS APPLY?
I am starting studies on SQL SERVER and some places teach to use the INNER JOIN to make the junction of two tables. However, there are some other places that teach via CROSS APPLY.…
-
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
answer59
viewsList data from 2 tables linked to the parent table
ORDER TABLE --------------------------- | id_pedido | pedido_data | --------------------------- | 1 | 2016-01-01 | --------------------------- TABLE PEDIDO_ITENS…
-
0
votes1
answer338
viewsJoin with various conditions
I have two tables and need to unite them bringing the result through the following conditions: The Numero_tel_origem and Numero_tel_dest table 1, has to be the same Numero_tel_origem Numero_tel_dest…
-
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
votes1
answer180
viewsInner Join Laravel
I am trying to select data from the module table through relationship in the Standard. Where I have 2 tables Module and Activities In activity I have id_modulo and I need to select a column called…
-
0
votes1
answer136
views -
0
votes1
answer63
viewsHow to return a data even if the table has no data
I wonder if there is any way to return a value even if the result of the query is null, for example in the query below I try to return the id 0 case to table1 be it null. I tried to use CROSS JOIN…
-
0
votes1
answer205
viewsMerge results from two tables
I need to make a SELECT in two tables and unite the results. My tables are "cursos_aula" and "cursos_progresso". In the table "cursos_aula" I have all the classes of a course. In the table "progress…
-
0
votes2
answers543
viewsPick up 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 from the price group table, which may have 1 or…
-
0
votes1
answer50
viewsUse of a Join to join two Tables
I wonder if it is possible and indicative to use a Join to "join" values contained in two tables made in a database of the SQL Server. I created two tables and one of them has general information of…
-
0
votes1
answer156
viewsCodeigniter update works but wrong list
I’m having a problem updating a bank record by codeigniter, I have two tables, one call: employee(where the employees of the company are stored and in which sector the employee works,this table has…
-
0
votes2
answers144
viewsGroup in mysql together with Join
I have a class table and a table of parents. A student may be associated with up to three parents. SELECT a.idAluno, a.matriculaAluno, a.nomeAluno, a.sexoAluno, a.dataNascAluno, b.id, b.matricula,…
-
0
votes1
answer46
viewsReturn average cost between partially equal products
As exemplified in SQL Fiddle, given the tables, the data will be returned as follows: nome | descricao| tipo | custo| ult_lancamento | entradas | saidas…
-
0
votes0
answers74
viewsHow to relate these tables, returning specific values?
[Firebird] sgbd - Ibexpert I need to know how to relate these two tables (comment below), so that I get the following results: TABLE:CONTARECEBER DTDOCUMENTO (date entered the system) MATURITY (date…
-
0
votes2
answers301
viewsSelect with two columns returning empty
In a mobile application (Android), I have two tables. A login table (user and password) and another (simple registration). The APP has a registration screen, if the user does not have an account he…
-
0
votes2
answers798
viewsSum with Internet Oracle
Staff need a help, I need to create a report that shows the total quantity of each product in stock, but I can not make appear the name of the products, only the product code and the sum of the…
-
0
votes1
answer730
viewsSelect connecting 3 tables in Firebird with different Ids
Good afternoon, I need to make a select that returns to description of the product,barcode and price. The description and price are in one table (TB_ESTOQUE) and the barcode is in another…
-
0
votes0
answers920
viewsAvoid a Cartesian plan in a Join with 2 tables with duplicities
According to the image above: The field A1 of TableA has two duplicate values which is key 3 and the TableB with the countryside B1 has the same duplicate values. I wanted to make a inner join…
joinasked 7 years, 4 months ago Deco Padaratz 11 -
0
votes1
answer54
viewsI am unable to gather data - must be lack of INNER JOIN
I have two tables, the tab_prefixo has number of prefixo and gerente responsible (important data), and in the other (table tab_valores), also presents the prefixo, plus nome, valor and data. I want…
-
0
votes1
answer291
viewsNode.js - Aggregate returns object
I am doing locally the Node.js exercise as Mongodb proposed in https://www.w3schools.com/nodejs/nodejs_mongodb_join.asp There are two collections, Orders and product. After aggregation, the expected…
-
0
votes1
answer860
viewsJoin between tables that do not relate directly
I have three tables: Candidate who has an ID as pk (which has been invented) Registration that has FK for Candidate ENEM that has no id representing the candidate, only his registration and…
-
0
votes2
answers740
viewsInner Join mysql 2 tables
Good evening guys, I need to link two tables and I’m not able to correct or find where I’m going wrong. I have two tables: Table 1: br_regiao | id - iduf - name - (1 , 1, Litoral) Table 2: br_estado…
-
0
votes3
answers103
viewsGet the same result from a query with Join
I have researched on some forums, consulted my books and looked in other sources, but I did not find anything to solve my problem. I have a query that queries the open value in a given table: select…
-
0
votes1
answer520
viewsHow to Join with Sum and Group By
I’m trying to do an SQL search using Join between two tables. The first table is a table containing monthly savings values for a given project. Each time someone registers a project on the site, a…
-
0
votes1
answer48
viewsHow to use a Join clause by adding a column indicating the existence of a connection
I have two tables Horas (id, aluno_id, atividade_id) and Atividades (id, emblema_id) In addition to returning all the badges, I need to return a column that tells me if that student has it. To know…
-
0
votes0
answers27
viewsQuery mysql with special condition
I’m having trouble assembling a query with two tables. In my comic I have two tables called disciplines and bulletin, in disciplines have the data of each discipline and in bulletin have the foreign…
-
0
votes1
answer160
viewsProblem with full Outer Join filtering with Where
Friends, I have a database with the following tables: guys id | nome 1 | Duplo 2 | Triplo availability data | tipo | ocupado | manutencao | referencia 01/03/2018 | 1 | 1 | 0 | 54684 01/03/2018 | 1 |…
-
0
votes1
answer138
viewsSelect JOIN + AVG() - Doubt with feedback
I’m solving an exercise but I’m having problems in return: Question: Write the query that returns the supplier’s code, the supplier’s name, the number of products per supplier and the average price…
-
0
votes3
answers931
viewsSql Help that queries 2 fields from the same table
I have the following problem to solve: I need to make an Sql that refers to an X table "Tabela X": id coluna1 coluna2 "Tabela 2": id coluna1 coluna2 coluna3. In "Table X" column 1 and column 2 are…
-
0
votes3
answers53
viewsFor each value of a table show the corresponding if no zero is shown
What I want to do is this: Show for each row of the seller table the number of passes sold, but if you have not sold any pass show 0. There is a previous query in the system that makes similar, but…
-
0
votes1
answer110
views -
0
votes2
answers864
viewsconsult with Internet in codeigniter
Good afternoon, folks, I’d like to ask for your help on something I’ve been racking my brain about and I can’t seem to get it right have 4 tables products ->id | Slug | title | info1 | info2 |…
-
0
votes1
answer47
viewsJoin two Mariadb SQL queries
Two tables tab_Ord_Ser and tab_Pos_Alb. In two different queries I can know the values but I’m not able to unite them in just one. Are they: SELECT Prazo_Producao as Data, COUNT( `Numero OS` ) AS…
-
0
votes1
answer221
viewsHow to Subtract MYSQL
How to do the correct subtraction of these two columns in the SQL script? SELECT DISTINCT b.prefixo as idVeiculo, max(datatroca) as datatroca, max(kmtroca) as kmtroca, max(horimetroca) as…
-
0
votes1
answer22
viewsReturn values if any record does not exist
I have the tables: tabelaUm [id] [nome] 1 nome1 2 nome2 tabelaDois [id] [idTabelaUm] [nome] 1 1 nome1 1 1 nome2 1 1 nome3 1 2 nome4 1 2 nome5 1 2 nome6 My query: SELECT t1.nome AS n1, t2.nome AS n2…
-
0
votes1
answer55
viewsI’m having some problems with GROUP BY
I’m having trouble assembling a select with the GROUP BY. What I want to do is this: I have three tables: bicos idbico, idempresa, idbomba abastecimentos idabastec, idbico, idempresa, valorabastecim…
-
0
votes0
answers32
viewsC# - Treeview error popular with SQL database tables
I’m in trouble and I need help. I want to popular a treeview with data from an SQL database, but I have an error when putting the data through the code it duplicates everything. My query: select…
-
0
votes1
answer50
viewsSQL 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 385 RODOLFO - COMPRAS 386…
-
0
votes1
answer167
viewsDeleting using subquery and Join
Guys, I’m getting started on SQL and I’m having a hard time making a deletion using subquery and Join. I created a temporary table EVENT_ITEM_PLACE_DYN_FIELD_BKP with 7000 rows, I need to delete…
-
0
votes1
answer527
viewsQuery in 2 tables that have columns with the same name
Good morning, I have two tables that have the column "st", when I pull the information comes from the table st "records", I would like to pull the "st" from the table "settings". sql = "SELECT *…
-
0
votes1
answer28
viewsAdd open plots with Join
I have two tables, Cliente and Parcela. The table Parcela owns the id do cliente as foreign key, a column pagamento that is null or contains the payment date in format date and a column valor that…
-
0
votes1
answer38
viewsfilter between two dates with Join
I have two tables: col (collaborator) and Indicacao. I made a select to know how many referrals each employee has. It’s working but I can’t filter by date using between. SELECT c.id, c.nome, funcao,…
-
0
votes1
answer60
viewsHow to bring data from another table related to an id_user (JOIN??)
I have the following tables: Users And investments The investment table has the user id. I’m already able to register. How do I show the investments made by a user on the screen? I’m already able to…
-
0
votes0
answers82
viewsJoin in 3 tables
I need my query to return who is the direct partner of the company "Father" and the company "daughter". I already got him to return the daughter company and the direct partner, but I need him to…