Questions tagged as 'sql'

1
answer

What are index hints?

I saw a comment from @RicardoPontual that mentioned density-based index hints    Your question seems pretty confusing .. it starts with a very basic thing   such as "how do I do a procedure on sql server", which is too simple for   find on...
asked by 23.05.2018 / 03:37
2
answers

Add multi-line values under condition

Good afternoon gentlemen, I have a query that returns me some fields I need the sum of them, only that before a condition select adm.adm_ds_administradora as descricao, sum(car.car_vl_cartao) as valor, 'Cartão TEF' as c...
asked by 28.05.2018 / 20:05
1
answer

SQL Query problems

I'm having problems with the following query: SELECT Cliente.Nome, (Reserva.NumeroNoites) TotalNoites From Reserva inner join Cliente on Reserva.ID_Cliente = Cliente.ID_Cliente group by Reserva.NumeroNoites, Cliente.Nome I would like to...
asked by 28.05.2018 / 11:39
1
answer

ORA-00911: invalid character

I'm having trouble with OracleParameter, I could not find the problem, because I can not see the sql after the assignment of the parameters ... follow the code: private DataTable GetSearch() { string sql_work = "select w....
asked by 03.07.2014 / 15:01
3
answers

Difference between SQL SERVER dates

I have a question in sql server . Based on the table below, how can I take the difference in days which takes to go from one phase to another of the same client, ie phase to phase difference. Example: The difference between...
asked by 27.04.2018 / 22:48
1
answer

SQL Group query with more than one distinguished attribute

I have an application that generates approximately 25000 records per day in DB. This will generate a large amount of id's per day in the user's DB. According to the user's business rule, only failed inspections ( is_ok = 0 ) must be log...
asked by 30.08.2014 / 22:47
1
answer

Using the SQL Firebird case statement

I'm trying to do the following sql in firebird. select distinct tb_proostarefas.*, (case WHEN (tb_proostarefas.dt_prev is null and tb_proostarefas.dt_vencimento < date) then 1 When (tb_proostarefas.dt_prev is not null and tb_proosta...
asked by 16.08.2017 / 13:12
1
answer

How to work with the IN statement in PHP + PDO? [duplicate]

I'm trying to build a dynamic SQL but I'm getting caught by not understanding how to work with the IN statement in the PDO Example: $SQL = "select * from tabela where (campo in(:valor))"; $Query = Database::Prepare($SQL); $Query->bindValu...
asked by 18.08.2017 / 22:20
2
answers

Group by mysql adding null values

How can I add empty values in group by ? Example: I have a query that is organized by ages: CASE WHEN TIMESTAMPDIFF(YEAR, STR_TO_DATE(DataNascimento, '%d/%m/%Y'),CURDATE()) < 4 THEN 'Menos de 4' WHEN TIMESTA...
asked by 27.07.2017 / 16:42
2
answers

how to specify values to sort sql server

Good afternoon! Well, I have the following query below, however, I want to sort by specifying some records. Attached for example, is the generated query and I want the Value column to look like this: Diamond Gold Bronze Silver How do you s...
asked by 12.07.2017 / 19:21