Questions tagged as 'sql'

3
answers

How to show an array coming from the database in an input

<input type="text" class="form-control" name="lanches" id="lanches" value="<?php echo $resultado['lanches']; ?>" > I have this input above where it receives this array that is inside the database How do I ...     
asked by 02.12.2018 / 02:28
1
answer

Select that picks up the last 30 days from the current date

Good morning, this is a part of query that I used to fetch the last days from the current date. It works as expected when I put -20 , but putting -30 does not. WHERE viacao_os.creation_date BETWEEN CURRENT_DATE() -30 AND CURRENT_DATE()...
asked by 21.03.2018 / 15:35
1
answer

How to check if a SQLite3 Database is valid?

I was testing and seeing what happens if the android create a database with wrong input values. For example, if I inadvertently typed NOOT instead of NOT or INTEGET instead of INTEGER, I expected SQL to point to a return error saying that the...
asked by 25.02.2018 / 21:15
1
answer

Query to sum total query

I have a Query to select a user list with debits I have to make the sum of these debits. SQL /* * PAGAMENTO */ SELECT pe.name as nomepessoa, py.created_at as datapagamento, py.amount_paid as pagamento, pys.name as status FROM...
asked by 27.10.2017 / 22:35
1
answer

Join in the database

I'm developing software where the user selects the items in his house, selects how long he does not clean them, and at the end he fills out a form to receive an e-mail discount and clean the items. All this data goes to the bank. However,whendo...
asked by 26.10.2017 / 18:28
1
answer

SQLite - too many levels of trigger recursion

I'm getting the error below when I try to insert into SQLite.    Error while executing SQL query on database 'BDTEST': too many levels of trigger recursion Creating the table CREATE TABLE INSTANCES ( ID INTEGER NOT NULL PRIMARY KEY AUTO...
asked by 23.10.2017 / 15:48
2
answers

INNER JOIN + LEFT JOIN

I'm trying to query the data in 4 tables : TAFCBHISTPED = NUPED, DTEMIS TAFGRPROD = CDGRPR, DSGRPR TAFPROD = CDPROD, CDGRPR TAFITHISTPED = NUPED, CDPROD, QTPED My query looked like this: SELECT TAFCBHISTPED.NUPED, TAFCB...
asked by 25.10.2017 / 19:05
1
answer

SQL Procedure (executed every second)

Can anyone explain to me how this mysql command will work? SELECT @row := @row + 1 AS n_linha , m.* FROM (SELECT b.user_id as prox_user_id, t.auctionID, t.productID, t.auc_due_price+t.auc_plus_price AS prox_valor, t.auc_due_time, b.id as...
asked by 21.10.2017 / 14:48
1
answer

How to do an Insert with conditions in SQL?

I'm trying to make an insert, where a column depends on a result INSERT INTO TABELA (ID, (CASE 'opcao1' WHEN 'opcao1' THEN "campo1" WHEN 'opcao2' THEN "campo2"...
asked by 20.10.2017 / 20:19
4
answers

Doubt with month and year extraction in PostgreSql data

I'm using a select command where I get the month and date year as follows: extract(year from D.dt_ficha) + extract(month from D.dt_ficha) But instead of appearing like this: 201711 November 2017, it is adding 2017 + 11 202...
asked by 09.11.2017 / 15:33