Questions tagged as 'sql'

1
answer

Mysql Query - Get the next value greater than 0

Example, I need the query to return these circled values. The previous result was 0 (zero). The current one does not. I need to get the current value. And list     
asked by 26.05.2017 / 20:49
1
answer

Calculate average of the value of registrations up to 100km sql

I'm doing a query that brings the average values, as long as the distance is up to 90km: SELECT avg(valor),(6371 * acos( cos( radians(-23.2632227) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-45.9414303) ) + sin( radians(-23....
asked by 25.05.2017 / 16:59
3
answers

Problem when ordering sql with orderby Date in postgresql

I have the following Query that results in joining the total sum of an account and the plots select sum(total) as total, datavencimento from ( select sum (con_valoraserpago) as total, to_char(con_datavencimento...
asked by 09.08.2017 / 01:25
1
answer

Ireport report appearing without data

I am making a report with Ireport and passing a parameter with date range My sql in report SELECT * FROM venda WHERE data between (venda.data = $P{dataInicial}) AND (venda.data = $P{dataFinal}) However, when testing the report in the p...
asked by 03.05.2017 / 04:11
1
answer

Error compiling function in oracle

When trying to compile the following function: CREATE OR REPLACE FUNCTION f_id_fornecedor(Nomefornecedor in varchar(50)) RETURN integer IS codigoforncedor integer; BEGIN SELECT codfornecedor INTO codigofornecedor FROM TBFORNECEDOR WHERE N...
asked by 02.05.2017 / 21:24
1
answer

How do I select a date in the format dd / mm / yyyy in mysql? [duplicate]

Good morning / afternoon / evening I need to select a field of TYPE DATE in mysql, the data is in the format yyyy-mm-dd , I need to return dd/mm/yyyy . Is there any way to do this in select? I have seen solutions with...
asked by 03.05.2017 / 15:50
1
answer

Default structure of a SQL Server procedure [closed]

I have a structure template, I would like to know if it is suitable for a good standard. USE [teste] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> --...
asked by 04.05.2017 / 16:22
2
answers

How to remove duplicate query values in two tables?

I am doing a query in two tables (students and users) and taking the values of id, name and email. Soon after I make a union between them. However, I wanted to have no rows with duplicate values for the email field. I need these values because f...
asked by 25.04.2017 / 17:39
1
answer

Select a row where a column has an element of a CSV

I have a table in the database with the following structure: +---------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------+------+-----+---------+--------------...
asked by 15.03.2017 / 18:35
1
answer

How to insert data coming from a form in the database [PDOstatment - CRUD]

I'm doing a simple CRUD for insertion of data obtained from a form. I did the function but it does not work and does not show any errors. I believe this is because information from form is not arriving via $_POST . I would...
asked by 15.03.2017 / 16:00