Questions tagged as 'sql'

1
answer

Why this query does not work in Oracle?

I'm translating a SQL Server query to Oracle and found an error that does not make sense and I'm not getting it fixed. The error displayed is as follows: ORA-00904: "ITM"."NRO_INT_ITEM": identificador inválido 00904. 00000 - "%s: invalid i...
asked by 12.01.2017 / 12:35
1
answer

How to use the Contains method in a search using the EntityFramework

I am trying to query sql , using EntityFramework : select * from pedidos where pedidoID not in (select pedidoID from agendamentos); I did some research and found that the EntityFramework method that replaces the not in of sql i...
asked by 22.02.2017 / 22:14
3
answers

Update in a field that can not be negative

I need to do a update in a certain field, where it should arrive at least until "zero" can not be negative. And when I get to zero I need it from the update of the remaining amount in the next field. "The setting is for it to drop the first...
asked by 05.01.2017 / 19:29
1
answer

How to recover the last record inserted in Firebird database?

My Sales table has a Code field with auto-increment and I need to retrieve this code to insert into an associative table. string sql = $"INSERT INTO VENDA(NRO_VENDA,DATA_VENDA,VALOR_TOTAL_PRODUTOS,VALOR_ACRESC‌​IMO,VALOR_DESCONTO,V‌​ALOR_TOTAL...
asked by 04.01.2017 / 13:15
3
answers

Insert decimal variable in firebird

I'm doing an Insert in the Firebird database in a UnitUnit (decimal) field, but the decimal places in the table do not appear. C # code: public decimal ValorUnitario { get; set; } produto.ValorUnitario = Convert.ToDecimal(5.50); string sql...
asked by 04.01.2017 / 20:56
2
answers

How to use sprintf to create a query with date_format ()

I'm reformulating a client system and it is using procedural mode in login and not PDO, but to give more security, I used sprintf , but it is not working. See: $sql = sprintf( "SELECT *, DATE_FORMAT(DataAcesso,'%d/%m/%Y') AS DataDeAc...
asked by 20.03.2017 / 23:53
1
answer

Doubt with select in mysql

Well I have the following tables: Orders id id_cliente id_vendador 1 10 20 2 10 30 3 10 20 Devolutions Id data id_pedido 1 2017/01/01 3 I...
asked by 04.02.2017 / 02:25
2
answers

How to change the format of a query result?

I would like to know if there is any argument in the select that changes the result format to be used as dump . Example: create table 'table_name' ('id' int, 'value' text); insert into 'table_name' values (1, "a"), (2, "b"), (3, "c"); sele...
asked by 07.12.2016 / 18:24
3
answers

Merge the result of a query on the same row from the sequence

I have the following query: SELECT * FROM SERQUENCIAL WHERE DATA BETWEEN '2017-01-01' AND '2017-01-19' It returns: +--------------+-------+------------+-----------------------+ | ID_PESS NOME | DATA | DATA_HORA | SEQUENCIAL...
asked by 19.01.2017 / 11:09
1
answer

For each result, a new line in php

I have a database where in the users table I have the columns: +----------+------------+----------+------------+----------+------------+ | imp_cod1 | imp_local1 | imp_cod2 | imp_local2 | imp_cod3 | imp_local3 | +----------+------------+-------...
asked by 18.01.2017 / 20:27