Questions tagged as 'sql'

1
answer

List Missing Period Days in SQL Server

How would I be able to do with what in SQL Server when confronting a table that holds the status records of a given code with a period table (Calendar of days) it brings me all the codes that are missing on those particular days For example,...
asked by 27.07.2018 / 21:15
2
answers

User with more than one profile

In the system business rule that I am working on, a user can have more than one profile. The profiles are: administrator, appraiser and responsible. For example: So-and-so can be both administrator and appraiser at the same time. My questi...
asked by 27.07.2018 / 04:20
1
answer

Get a certain number from a string in select

I need to get a certain number that is inside a string (in this case the return of a select ). The table is written like this: CreditCash_Aderencia_AD_20180823;20180823;Arquivo convertido para CSV com 503 linhas CreditCash_Aderencia_2018...
asked by 24.08.2018 / 19:16
1
answer

How to use foreign key in SQL statements?

I'm trying to use the foreign key but I can not. This SQL statement will create a table named tbl_estado with 4 columns id, nome, uf, pais and in column pais will enter the foreign key that will be searched in tbl_pais...
asked by 17.10.2014 / 18:36
3
answers

How to browse tuples for an ID and check their values?

In a table where I record the number of parcels and the situation of each parcel, I need to go through it and find the sales orders where all parcels are paid. Ex: SELECT * FROM tabela_parcelas WHERE ID = X Return: ID Parcela | S...
asked by 20.10.2014 / 22:45
2
answers

With limiting the result of Select in Oracle

I'm doing a select from the bank and it's returning me 15 lines. I used ROWNUM to get the first 8 lines, but I want to make another select and pick up from line 9 to 15. SELECT * FROM (SELECT DISTINCT o.STORAGE_TYPE, COUNT(o.QUANTIDADE) as qt...
asked by 01.10.2018 / 16:35
2
answers

How to give a select and bring the top 1 of each group?

I have a table of processes. That is, each time a process is run, it generates a new row. I want to give a select bringing the last execution of each process. Here is an example: Id|ProcessoNome|Situação|DataInicio 1 |RPA_001 |suces...
asked by 04.10.2018 / 21:56
1
answer

select distinct in temp table sql server

I have the following code: (it is from a table that the representatives have the same code, which generates duplicate values, I solve this by picking the most current representative, in short the last face that synchronized) / em> select dist...
asked by 04.10.2018 / 21:41
1
answer

Search with group by

Suppose the following table that records author posts in a blog. An author can have several posts. So I have several reps of authors on this table of the different posts he made. How do I make a query to fetch the content of the most re...
asked by 23.09.2018 / 05:54
1
answer

Syntax error in 'with' with SQL Server

Have the following error in sql server:    Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement should be terminated with...
asked by 02.07.2018 / 22:11