Questions tagged as 'query'

0
answers

How to pass the variable in postgres using dbblink

Oops, good morning! I have the following query in postgres: declare $1 VARCHAR; BEGIN IF (SELECT COUNT(*) FROM tempo2 WHERE looping IS NULL) > 0 THEN $1 = (SELECT banco FROM tempo2...
asked by 17.04.2018 / 15:51
1
answer

Use LEAD to get the next date

I'm trying to put together a query that answers the following question: Number of customers (registration in the case) that has a 26-day reading date, number of clients that have 27-day reading, and so on up to 31 days, I will show an image e...
asked by 21.03.2018 / 06:34
0
answers

What is wrong with this method?

I am creating an asp net mvc application, I created a domain class with: public class Parcela { public int parcelaId { get; set; } public decimal valor { get; set; } public DateTime vencimento...
asked by 07.03.2018 / 17:12
1
answer

How to echo the value of a variable from the query result

To automate my process of generating a JSON , I save the name of the variable in the database (Ex: $teste_value_1 ). In my file.php I have the value of this variable, for example $teste_value_1 = "Isso é um teste"; . Then I...
asked by 08.03.2018 / 19:56
2
answers

SQL query that compares two tables and returns values

Working with a database using PostgreSQL DBMS, where I need to compare tables, eg: table_janeiro and table_February. I need to perform two queries ... 1st Should return the values contained in the table_janeiro and do not contain in th...
asked by 07.03.2018 / 20:08
1
answer

Retrieve the last value found inside a string

I need to take an average of payment terms in the database and I came across the situation where the condition column is a string and it can receive parcel values separated by slash. I need to get the last value after the last bar, percent sign...
asked by 20.02.2018 / 19:35
1
answer

Find table field with query result from a different table?

I recently asked a question: search for last 24h lines that repeat the most (MySQL) And it was answered, I now have another question. I do the following to find from and to of the most repeated lines of the last 24h, but th...
asked by 22.02.2018 / 03:38
1
answer

Help to build mysql query

I have the following table in MySQL: cod, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15 the fields d1 ... d15 are filled with values between 1 and 25 in each record. There is no repetition of values within a record. How can I...
asked by 12.02.2018 / 02:33
0
answers

Join querys using outer apply

I have these three querys , and I want to merge them using outer apply . How can I do this? SELECT SR1.COMPANY, SR1.FILIAL, SR1.DOC, SR1.SERIE, SR1.LOCAL, SR1.TIPONF, SR1.CLIFO...
asked by 15.02.2018 / 13:09
1
answer

Query works in phpmyadmin, but does not work in PHP

I'm trying to make a query via php in Mysql, but it's not working in PHP, but it works in PHPMYADMIN. $check_in = strtotime($arrival); $check_out = strtotime($departure); Queries I've tried in PHP ... $query = "SELECT * FROM wp_st_availab...
asked by 15.02.2018 / 17:26