Questions tagged as 'join'

3
answers

Problems with LEFT JOIN

I'm breaking my head a few days ago with SQL on something that should be pretty simple, but I can not figure it out. I want to get all the data in the [NumOrdem] table including those that are not in the [ItemNotes] table with the following S...
asked by 10.12.2014 / 20:53
1
answer

SQL JOIN multiple tables

I have 4 tables that I need to extract the results, but I always get duplicate records, can anyone help? tabclientes: codcli nome 1 A 2 B 3 C tabrepre: codrepre nome 1 AA 2 AB 3 AC tabvendedor: codr...
asked by 10.07.2018 / 23:00
2
answers

How do I list all the fields in a table plus a random value from another table?

I'm having a problem when dealing with two tables, tb_adm_anuncios and tb_adm_anuncio_banner . For each ad I have 4 banners, and to list those ads I need: **Anúncio:** -Nome do Anúncio -Link **Banner:** -Imagem The command...
asked by 27.07.2017 / 16:33
2
answers

How to select single data from a conditional join?

I have 2 database tables: servers +----------+--------------+ | Field | Type | +----------+--------------+ | id | int(11) | | ip | varchar(255) | | votes | int(11) | | port | varchar(255) | | hash...
asked by 13.11.2016 / 20:33
1
answer

Count records only if greater than the current datetime, with count ()

I have the following query : SELECT u.nome, u.email, u.login, u.data_cadastro, COUNT(*) AS qtd FROM patrocinadores AS p LEFT JOIN anuncios AS a ON a.id_user = p.id_user INNER JOIN usuarios AS u ON u.id = p.id_user WHERE p.id_patrocinado...
asked by 05.12.2015 / 02:39
1
answer

SQL Server 2012, questions

Based on the attached table, could you tell me if the resolution for the exercise below is correct?    Show orders that have items that were sold at a discount (discount occurs when the sales price - ITE_PrecoUnitario - is less than the price...
asked by 10.11.2015 / 17:43
1
answer

Left outer Join does not have Null values [duplicate]

I have two tables: formulario_campo ( cod_campo, descricao, cod_formulario ) Filled with the following values - input_nome, Nome, 1 - input_sexo, Sexo, 1 The second table: — formulario_valor(cod_campo,valor,cd_oportunidade) In...
asked by 21.01.2016 / 14:40
1
answer

Edit records of a clientdataset of fields coming from a join

I have a simple example, but in three layers, with sqldataset + datasetprovider + clientdataset. I do not load any fields in the sqldataset. In the datasetprovider I leave the updatemode in upwherekeyonly. In the datasetprovider I leave allow...
asked by 24.02.2015 / 07:06
2
answers

Join table using a SubQuery

I have 3 tables: inscricaoaluno , inscricaoescola and prova , with the following structures: PROOF    IDPROVA | DESCPROVA | TYPE | QTDEMAX REGISTRATION    PROFESSOR | SCHOOL (IDESCOLA) | DTINSCRICAO | IDPROVA...
asked by 24.03.2015 / 17:53
1
answer

SQL - How to make multiple INSERTs in a table with the result of a SELECT * of another table in a query

Hello, I would like to know how to make multiple INSERTs in a table with the result of a SELECT of all ids of another table table that are not as foreign key in the first table. I already have the SELECT query with LEFT JOIN: SELECT id FROM...
asked by 30.10.2017 / 14:28