Questions tagged as 'select'

1
answer

Compare COUNT of two tables

I have two tables and should I return the table total with more data, I'm doing this: SELECT CASE WHEN ((select count(*) as 'familiar' from tb.familiar)) > ((select count(*) as 'personal' from tb.personal))...
asked by 19.10.2016 / 17:54
3
answers

How to mount SELECT?

I have a Products table with: ProCodigo - Primary Key de Produto ProNome And another Price History table with: HisCodigo - Primary Key de Histórico HisData HisPreco ProCodigo - Foreign Key de Produto I need to mount a SELECT that bring...
asked by 22.01.2016 / 18:06
3
answers

Subtract date and display in YEARS, MONTHS and DAYS

DBMS: MySQL Problem: How do I return the subtract of the current date with a specific date and return the value in YEARS, MONTHS and DAYS in a query? Example: DADOS DataAdmissao dataAtual 2010-04-07 2014-06-27 (este dado não está...
asked by 27.06.2014 / 21:33
1
answer

Query to join one column from another

I have tried unsuccessfully to get a result. I have the table with the following Login and Logout information: |Group |User |EventDate |Event |Camp ------------------------ |Evolution |1012 |2014-07-07 10...
asked by 08.07.2014 / 17:40
3
answers

Select months even without records

I need to select the data stored in the database and separate them by month, but when the month does not have data yet, the month is not returned. I need the month to be returned with the value zero but to bring the month anyway. My Query...
asked by 22.11.2018 / 18:07
1
answer

Pass variable value into nested SELECT

Assuming the following query where we are selecting values, grouping them and then re-grouping the result: SELECT CONCAT (b.label, '|', b.slug) FROM ( SELECT group_concat(name SEPARATOR '$') AS label, group_concat(slug...
asked by 09.04.2015 / 18:31
2
answers

SQL Server - Check duplicate data in two concurrent fields

DBMS: SQL Server 2014; Problem: I need to know which records are duplicated, so that the verification is done in two simultaneous fields, ie if the field "CPF" with the value '83971465842' and the field 'MAT' with the value ' 001 'exists, in...
asked by 25.06.2014 / 22:39
2
answers

What is a "0" field in SQL SELECT?

I did not understand the use of 0 in this code: SELECT substring ... 0 AS PARCELADO, ... FROM ... What does it do?     
asked by 08.12.2014 / 17:48
3
answers

What is the purpose of the MINUS command in oracle?

I've never seen this command before and I also do not find it around here, I do not know if it has a different name and because of the Oracle documentation, I can not understand exactly how it works. I just want an explanation and a simple examp...
asked by 12.06.2015 / 20:12
1
answer

Concatenate two sql

I have the records: |DT_OBS | DESC_OBS | COD_TURNO | COD_PERIODO| |01.10.16| TESTE 01| 1 | 1 | |01.10.16| TESTE 02| 2 | 1 | |01.10.16| TESTE 03| 1 | 2 | |02.10.16| TESTE 04| 1 |...
asked by 04.11.2016 / 18:44