Questions tagged as 'select'

2
answers

select multiple columns group by 1 column

I have a table with 300mil records and inside it there are several different fields, I would like to take the line that contains the largest DATAEMISSAAPURADA for each CPF_1 What I have: ID NUMERO DATAEMISSAOAPUR...
asked by 14.08.2017 / 20:01
1
answer

Error With Connection in Bank phpMyAdmim (New Code) Nothing is solving [duplicate]

Look, I'm not sure where to start but, anyway ... I have the page posted below, and I have already checked some with errors in the database and insertion of data in it. The code was made in case there is some kind of error it indicates during...
asked by 23.08.2017 / 20:43
1
answer

PHP / MySQL Select total balance of 1 client in the table

My client JOSÉ appears 4 times on this table, and I wanted to get his balance total. How do I do this? tabela "clientes" ID NOME SALDO 1 josé 10 1 josé 20 1 josé 30 4 maria 50 5 marta 60 1 josé...
asked by 21.09.2017 / 21:04
1
answer

How to return pilot names in SQL table?

I have the following tables below, and would like to return only the name of the riders who have never participated in a race in a Brazilian circuit in the country brasil . Table Structure: PAIS (id, sigla, nome) EQUIPE (id, nome, pa...
asked by 14.07.2017 / 16:22
1
answer

Laravel 5.4 - Show all phones of each result

I have the table convenios and telefones , each convenio has 1 or several telefones and a screen where all convenios are listed, I need to have all the phones related to each agreement. I can not search the p...
asked by 15.07.2017 / 15:30
2
answers

Make top 10 by checking 3 tables

I have 3 tables: sponsors id | id_patrocinador | id_usuario quotas id | id_user | quantidade users id | nome | login What I need to do is a TOP 10 where I list 10 users who have sponsored with active quotas. For example...
asked by 21.04.2017 / 07:05
1
answer

Mysql Query - Get the next value greater than 0

Example, I need the query to return these circled values. The previous result was 0 (zero). The current one does not. I need to get the current value. And list     
asked by 26.05.2017 / 20:49
1
answer

List the last message of each user

Does anyone know how I could list the last message of each user? I was able to do this but list the last message of only one user, and I wanted it to list everyone who sent the message to the user in question (code 3). SELECT m1.codigo,...
asked by 27.05.2017 / 04:20
2
answers

Customers who bought in one year but not in another [closed]

I need to make a select that brings me which customers I bought in 2016 and did not buy in 2017 and vice versa. This is my select: SELECT tc.'cod-emitente' AS CODIGO, tc.'nome-emit' AS CLIENTE, fg.'ano' AS ANO FROM tb_clientes tc LEFT JOI...
asked by 26.05.2017 / 18:54
3
answers

Problem when ordering sql with orderby Date in postgresql

I have the following Query that results in joining the total sum of an account and the plots select sum(total) as total, datavencimento from ( select sum (con_valoraserpago) as total, to_char(con_datavencimento...
asked by 09.08.2017 / 01:25