Questions tagged as 'query'

1
answer

How to compare the values of a column with the mean of these values in SQL?

I have a column of books, and I want to just show the books that the price is higher than the average of these prices, how to do that? The name of my column is price , and I can not put a where price > avg(price) , nor a having...
asked by 25.08.2017 / 15:38
3
answers

How to calculate two columns and compare the result with another column?

I have a table, where I am bringing two different results with the query below: select sum(qtde_pontos) from dbo.tbl_cc_ponto where re = '9289' and natureza_operacao = '2' and data_lacto >= '2012-01-01' and data_lacto <= '20...
asked by 10.08.2017 / 23:42
2
answers

I have this query and I am not able to group by month

DECLARE @Year INT = 2005, @Month INT = 7 SELECT --SequenceNo = ROW_NUMBER() OVER(ORDER BY OrderDate), Year = Year(convert(int,OrderDate,111)), case Month(convert(int,OrderDate,111)) when 1 then 'Janeiro' when...
asked by 10.08.2017 / 23:19
1
answer

Querys have stopped working

Recently I made a change in the table and after that SELECT and INSERT INTO stopped working. At first INSERT INTO could not include data in the last column that includes (centid), it returned column 'centid' cannot be...
asked by 21.02.2017 / 21:13
1
answer

Group query for similar but not identical records

I need to migrate a database (from SQL Server to PostgreSQL and I'm creating an ETL interactive in PHP to make this change), which is about 10 years, some 2 million records in the table clientes no has verif...
asked by 03.09.2016 / 20:32
1
answer

SQL, subquery if null

I'm doing a query, but I did not want it to return NULL. What I have is this: select ifnull(sum(job_withdraw_qty),0) as total, ( select IFNULL(sum(job_withdraw_qty),0) from job_positions where DATE_FORMAT(job_positions.created_...
asked by 14.11.2016 / 19:01
3
answers

How to group results in a row?

I would like to perform a query on the FILE_EXAME table with the following data: CREATETABLEFICHA_EXAME(FICHAsmallint,EXAMEVARCHAR(15));INSERTINTOFICHA_EXAMEVALUES(1,'Hemograma');INSERTINTOFICHA_EXAMEVALUES(1,'Colesterol');INSERTINTOFICHA_EX...
asked by 10.12.2015 / 14:28
1
answer

php echo of html tag as text

I have a query in php / oracle that hides a "" tag while displaying the result in the browser while in oracle sql developer displays everything ok. Expected: '
asked by 25.11.2015 / 15:09
1
answer

LINQ TO XML Query with Optional Element

Hello everyone, I am having a question about displaying the data from an XML file through a LINQ query , the problem is that I am trying to query the person's data but the and then the NullReferenceException and Endereço and NullReference...
asked by 30.10.2015 / 19:32
2
answers

Problem with query in php because of quotation marks

I'm having trouble with a query in php as follows, Example: INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Cardinal','Tom B. Erichsen','Skagen 21','Stavanger','4006','Norway'); This query wor...
asked by 07.04.2016 / 15:20