Questions tagged as 'sql'

1
answer

How to save data from a CArrayDataProvider in the database?

Hello, I have a CArrayDataProvider and I wanted to save your data to a table via a model, I already tried it in several ways and did not get results, what would be the best way to save it? My last attempt so far: foreach...
asked by 25.05.2018 / 15:36
1
answer

C # CRUD - Insert Error (Can not add or update child row: a foreign key constraint fails ...)

Good morning, I had been able to do everything right up to this error when inserting something into the database. localhost / phpmyadmin - xampp. It's something with id_user but I do not know what it is. I do not insert a txtbox...
asked by 25.05.2018 / 10:59
1
answer

How to set the time of a timestamp to 23:59:59 in postgresql?

I have a cell that contains only the date, in the case 2018-07-11 , I need to make a select that will bring that cell like this: 2018-07-11 23:59:59 , is it possible to do that?     
asked by 11.07.2018 / 22:32
1
answer

SQL Join multiple tables only the 1st result

I have 3 tables: **clientes** cli_cliente nome 50 A 52 B **telefones_cliente** cli_cliente tel_telefone 50 387 50 386 50 385 52 400 **telefones** tel_telefone tel_contato 3...
asked by 12.07.2018 / 15:31
1
answer

query update error

The $query1 and $query2 work, but the $query1a update is not set, does anyone know if it is a syntax error? $conexao = mysqli_connect('localhost','rr','4ai','rr') or die('Erro ao conectar ao banco de dados'); $query1 = "...
asked by 21.05.2018 / 15:37
1
answer

How to shrink a large query - Postgresql [closed]

In Visual Studio, we have the possibility to shrink a large code, that is, visually decrease the size, as a way to make reading easier, for example: #region Seu código aqui... #endregion I would like to do the same in a query within my PG...
asked by 21.05.2018 / 18:24
1
answer

bank query with ajax on beforeSend

How to query the bank with ajax on beforeSend ? Example: var formData = new FormData(this); $.ajax({ url: "../_requeridos/cadastraPlano.php", type: 'POST', data: formData, beforeSend: f...
asked by 31.05.2018 / 14:37
2
answers

How to insert for all users in PLSQL when there is no data?

Good afternoon! I'm trying to insert all users when there is not a type entered for all users: INSERT INTO USUARIO ( TIPO, PRIORITARIO) SELECT '130', 'N' FROM dual WHERE not exists (SELECT * FROM USUARIO WHERE tipo = '130'...
asked by 30.05.2018 / 19:00
2
answers

Update or insert with data from another table

I have this SQL command to update the REQUISICOES table with the data in the REQUISICOES_ATUALIZA table. Use as a key to update the field number_requisition, but I need that if I do not find correspondencia in the...
asked by 30.05.2018 / 17:24
1
answer

Update a value in a column with conditional comparing 2 columns of 2 different tables

In a table, I need to enter the 'Assembly-Related ID' value in a field, with the following condition: This value can only be entered when the value of the "Table1_ID" field is equal to the values that are in one field ("table_id2") of anot...
asked by 14.06.2018 / 15:22