Questions tagged as 'sql'

1
answer

Return of duplicate SQL results [closed]

I have the following SQL SELECT 'inte'.'int_nome', 'age'.*, 'con_at'.'con_nome' as consultora_que_atendeu, 'con_ag'.'con_nome' as consultora_que_agendou FROM ('agendamentos' as age) JOIN 'interessados' as inte ON 'int...
asked by 18.08.2016 / 16:22
1
answer

Return dates between days quantity [closed]

I would like to know what I do: I want a variable of type days Then get the result of this variable and make a select between the dates counting the number of days Any solution or example?     
asked by 04.12.2018 / 21:03
1
answer

UPDATE in two tables [closed]

I would like to make a update using a Inner Join . I've tried this: UPDATE m SET m.rua = 'Rua Major Gote', b.desc_bairro = 'Centro', m.id_tipo = '', m.numero = '652', m.CEP = '38700001', m.cidade = 'Patos de Minas' FRO...
asked by 16.08.2017 / 16:24
1
answer

Does anyone help me find the error in this create?

CREATE TABLE PedidoProduto + ProdutoPedido ( Quantidade numeric(50), IDproduto int, IDpedido int, FOREIGN KEY(IDproduto) REFERENCES Produto (IDproduto), FOREIGN KEY(IDpedido) REFERENCES Pedido (IDpedido) ); No error gives this:    Message...
asked by 13.05.2018 / 22:13
2
answers

How to select only the people with the first name [closed]

I would like to know how to select people who have only the first name, that is, they do not have a last name. Example: Nome ---------- Leonardo Roberto Ana Júlio Maria Ana Expected result:    Ana, Júlio     
asked by 06.12.2018 / 11:26
1
answer

Conditional in MYsql clause

I have select normal SELECT campos FROM tabela_Z WHERE condicoes I would like to query add a field that is another query . SELECT campo1, campo2, campo3, (SE houver o id X na TABELA _, = true, caso contrar...
asked by 04.01.2019 / 20:08
1
answer

Return a single line where it currently returns 2 or more

I'm trying to get a die, but it doubles when I try to do it. It duplicates if PARC_COD is the same, but should only bring the sum of the return value column on a line indifferent to what it has next. I just need a column. Here's an exa...
asked by 04.06.2018 / 17:36
1
answer

Good practices with great queries? [closed]

Are there good practices when it comes to SQL queries within php? Or is there an alternative not to "dirty" the code with a giant query in the middle? Edit: What I was looking for was just views, but I did not know the name to look for, the answ...
asked by 08.02.2017 / 22:02
1
answer

System access control [closed]

How does it make for each user to have a product, client, etc. individually in a login? Ex: User John does not see samuel's registry.     
asked by 30.11.2017 / 18:26
1
answer

SQL how to create fk int in TABLE

Movie COD (int, pk) name (varchar 20, not null) birth (datetime, not null) obs (tinybit, not null) obs2 (int, fk, not null) I thought of something like create table filme ( COD int PRIMARY KEY AUTO_INCREMENT, nome varchar(200) NO...
asked by 10.10.2018 / 07:06