Questions tagged as 'sql'

2
answers

How to group and remove rows with null values of this query in MySQL

CREATE TABLE tblCliente ( idCliente int(11), estado int(1) ); CREATE TABLE tblPergunta ( idPergunta int, idCategoria int, pergunta varchar(255), tipoResposta tinyint(1) ); CREATE TABLE tblClienteRespostaPre ( idCliente int(11), idPergunta int(1...
asked by 29.10.2015 / 19:02
1
answer

Joining multiple SQL queries into a single query

I have a 'mission' in my work, where I need to join some queries in a single query. But I have no idea how I can do this so that everything I need is returned with just one query to the bank. Is there any way to merge queries? UNION does not sol...
asked by 03.07.2014 / 15:10
1
answer

Make an INNER JOIN using the IF

I'm doing an INNER JOIN from the Combo Table with the Product Combo Table as I show below ... SELECT C.SchoolID, C.ComboID, P.Active, P.Name, P.ProductID FROM sales.Combo AS C INNER JOIN commons.Stock AS S ON C.SchoolID = S.SchoolI...
asked by 16.04.2014 / 18:55
2
answers

Remove from account when value is 0

I have the following query: SELECT ROUND((( notaAmbiente + notaApresentacaoDasPizzas + notaQualidadeDosProdutos + notaVariedadeDeSabores + notaAtendimentoNaLoja + notaAtendimentoNoTel + notaAgilidadeNaEntrega +...
asked by 11.06.2014 / 20:14
2
answers

Show users online

asked by 26.03.2014 / 03:43
4
answers

SQL query returns total days in a month on two dates

I have the following tables: official : official_id other information ... history : official_id data_entrada data_out I tried some querys but could not get what I wanted. What I need is, after the user has chosen a mon...
asked by 31.08.2014 / 04:06
2
answers

How to save space in audit log?

I was creating a system that would give me data from my users according to the date I requested, from X to Y for example. And the only way I found it was to create a table like this: date with date inserted in DATE format name...
asked by 27.12.2014 / 18:55
1
answer

How not to bring a certain column in SQL, using IF and ELSE?

Gentlemen, I have a table where I want to bring the column when the value is null but when it is filled it should not be displayed, how can I implement this condition in SQL? SELECT OBS.NUOBS, OBS.DTOBS, OBS.CODUSU, OBS.OBS,...
asked by 19.09.2018 / 15:46
2
answers

How to return a special character in a query

Good morning! It may be simple to doubt, but I'm starting in SQL Server yet, so I'd like to know how to return a select a special character. As you can see, there is the presence of a single quote in the Nat_Rec field and I can not put it in...
asked by 11.09.2018 / 13:46
2
answers

PHP SQL Inner Join - Show name instead of ID number

I'm having a little difficulty regarding query INNER JOIN. I have a table called users and it contains the following fields: First Name Last Name Tipo_fk (Foreing Key) Categoria_fk (Foreing Key) As shown above, the HTML select function work...
asked by 31.08.2018 / 05:19