Questions tagged as 'join'

1
answer

Using Case When with LeftJoin

I am putting together a proc, but depending on the value of a parameter, I would like the left join to be different. I have tried the querys below: This works, however, else as null or even else , if the parameter COD_...
asked by 07.08.2016 / 22:45
1
answer

How do I select multiple fields in the same query?

I created a dummy bank with the following structure: BelowarealsothenumberedSQLServerscriptsforcreatingthedatabase,ifneeded. SQL Fiddle Now, what I want is to make a query where they are shown: The limit of an additional holder - pre...
asked by 05.09.2015 / 22:00
1
answer

inner join query, left join mysql

I'm working with the following tables: CREATE TABLE livro ( Id_livro int NOT NULL, Nome_livro CHAR(40) NOT NULL, Pg int, Edicao int, Editora int NOT NULL, Assunto int NOT NULL, Preco decimal (5,2) NOT...
asked by 10.06.2017 / 19:10
2
answers

Passing values from a select to subselect

I have the following query: SELECT rp.colaborador as codigo_, t.nome, count(rp.*) as presencas, ((100 * (select count(rp.*) from empresa.cad_reuniao_presencas rp join empresa.cad_terceiros t on t.codigo = rp.colaborador join emp...
asked by 21.05.2015 / 18:51
1
answer

Automating Inner Join using LookupComboBox component

Sometimes I use the TDBLookupCombobox component to bring up a list of a dataset lookup field, this approach streamlines some things but is quite limited. For example I have a list of stores in one TDBLookupCombobox and another a list of clien...
asked by 21.02.2015 / 08:29
2
answers

Which is more efficient, perform multiple queries or use JOIN?

I have a X table that has my user's data, and I need to return data related to that user to the Y and Z table to the client. I can do this using JOIN or: SELECT attr1, attr2 FROM Y WHERE X_id = id SELECT attr1, attr...
asked by 01.11.2017 / 14:54
2
answers

How to differentiate data from two tables with columns of equal names in a SQL request with JOIN?

I've combined two tables with JOIN , the two tables have some columns with the same names ... When extracting data with PHP how will I differentiate? Example : foreach($dados as $values){ echo $values['price'];...
asked by 07.12.2016 / 12:26
2
answers

Using WHERE with INNER JOIN [duplicate]

Is there a way to use WHERE to make a SELECT with INNER JOIN ? My case is this: SELECT CodCli, NomeCli FROM tbvendas INNER JOIN tbclientes ON tbvendas.CodCli = tbclientes.AutoCod I would like to put a WHER...
asked by 17.11.2016 / 15:57
3
answers

With LEFT JOIN list the NOT IN

In Mysql I have the table usuario , with the fields ID and CPF : IreceivedalistofsomeCPFsfromtheclientandwhatIneed:SeewhichoftheseusersisNOTintheusuario_gerenciamentotable,theproblemisthattheusuario_gerenciamentotabledoesn...
asked by 06.12.2018 / 13:48
2
answers

Get values from one table that are not contained in another

I would like to know how I can get values from a mysql database where the data obtained must be in one table and not in another. For example: I want all equipment (table equipment) that is not reserved (table reservations)     
asked by 08.04.2015 / 22:10