Questions tagged as 'sql'

1
answer

Return array in SQL in a php variable, for later assembly of HTML

I need to do a database search on a variable date and return only the Years. For this I did the following: In Control: public static function getDataAnos() { $bd = new Banco(BANCO_HOST, BANCO_USUARIO, BANCO_SENHA, BANCO_BASE_DADOS);...
asked by 14.11.2017 / 21:41
1
answer

Inner join without duplicate rows, bring the first value I find

I have the following table with the fields below SELECT NR_ANO_MES, nr_contract, product_type, NM_PRODUCT, sum (QT) as QT FROM   INN.FT_VENDA The product_type field has 3 classifications (Video, Data, Voice) and the Product Name field h...
asked by 14.11.2017 / 19:43
0
answers

Order of execution of searched CASE expression

The CASE WHEN has two ways to function, with simple expressions and searched:    The expression simple CASE compares an expression with a set of   simple expressions to determine the result.       The expression searched CASE eval...
asked by 14.11.2017 / 16:39
0
answers

Query Performance - HELP

I'm doing a query , however I'm learning now. Can you improve the performance of this query? select a.COD_EMPRESA, b.Dat_pagamento from SAS_EMPRESA a full outer join SAS_ITEM_PAGO b on (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA...
asked by 17.11.2017 / 19:28
0
answers

Add in base SQL in a letter

Good afternoon! In a database I have two tables. A call to Accounts, where you have for example a column of accounts 1 (Active), 1111 (Bank), 1112 (Banks), 1113 (Receipts). Another table called Values where you have the value of the accoun...
asked by 09.11.2017 / 18:41
0
answers

PostgreSQL compare time between two hours, and if you exceed the hours of the day, limit until 23:59

I am making a query sql on ruby-on-rails on PostgreSQL where I check if user input is between hora_entrada and hora_entrada + (hora_entrada + limite_banco_horas) and same for hora_fim , in a certain...
asked by 09.11.2017 / 17:35
3
answers

Connection to sql database on several php pages

I'm creating a site where several pages need to connect to the bank to perform their operations, for example, I made a login system, so the user clicks on 'login' opens a bootstrap modal to enter the data . I created the page "validaLogin.php" t...
asked by 10.11.2017 / 12:44
1
answer

Problems with using Ajax request

When I try to make a request to return an sql query to the form fields it returns only the first row of the table, how can I change my code to search for all rows: code that makes select: <?php class Medico { public $nome; } try { req...
asked by 10.11.2017 / 21:59
0
answers

Bootstrap modal login

I created a login button in the navbar of the site, when the user clicks open a modal with the login form. In the navbar php file I am calling the file "validaLogin.php" to check the user data and store it in a session variable, but when I submi...
asked by 10.11.2017 / 14:04
1
answer

Error converting varchar field to float

I am generating a Query and in this Query I am doing a join between a varchar field and a float field. Since the field SY.YE_MOEDA is varchar and the DA1_A1_MOEDA field is float . Follow my Query: SELECT DA.D...
asked by 11.11.2017 / 18:07