Questions tagged as 'sql'

2
answers

return query as zend string

I have the following code where I need to save $ error_itens the complete query with the parameters to analyze what is happening, my question is, how do I show this query? $sql = new Sql($this->adapter); $query = $sql->in...
asked by 16.06.2016 / 05:59
1
answer

Query to return recurrence values, which have not yet been created in the database

I need to query the database where the records are not yet saved. I'll explain better: In a system that I am developing, the user can register a recurring expense, that is, that will repeat every month / days (according to the user's choice)....
asked by 12.12.2015 / 18:05
2
answers

SQL Autodelete query

How could I do a self-checking query in SQL, ie I would like to query such a value and then delete it in only one query. EX: select * from usuarios where nome=lucas that is, to get the result of searching and deleting. I know I would the...
asked by 02.01.2016 / 16:56
4
answers

Help with PHP and MSSql special characters

I'm making a form, and when I write the information with special characters, it records good ... only that when I retrieve the information it comes encoded ... I've already used it, utf8_encode / decode and nothing I do not know if it's in php o...
asked by 04.02.2015 / 21:27
3
answers

Condition select

I need to create a SELECT that contains only records of an x value onwards. For example, returning only movies with number of copies greater than 5 My Select router.get('/filmes', (req, res) =>{ execSQLQuery('SELECT IF(copias >...
asked by 07.12.2017 / 13:41
3
answers

Insert image into database [closed]

What kind of variable do I use to store an image in the database? And is there a specific command for this? or just insert as any record? I have a product table with fields: code, name, price, image, in the image I intend to store a produc...
asked by 20.05.2014 / 14:57
3
answers

Add time column in SQL SERVER

I have a column of type time in a table. With records like: 00:02:15 00:09:47 00:00:25 ... I need, in my select , to get the sum of those minutes in time format . Return example: 00:12:27 I have tried in many ways without succ...
asked by 06.03.2018 / 12:12
2
answers

How to perform an "IF" by SQL

Hello, how can I do something similar to an if but per sql? For example: There is a field in the database named dt_ini with no value so far. I would like to do: "If dt_ini == '' insert into table ( dt_ini ) values ..." I would have to que...
asked by 04.10.2017 / 19:42
6
answers

How to count the number of clients that have returned from one year to the other through SQL?

I have a Serviços(Nro_Serv, Data, Cliente, Valor) table and would like to get customers who did service with me in a year X (ex: 2011) and who also did in a year Y (ex: 2012). I tried to use COUNT(*) and then GROUP BY Cliente HA...
asked by 20.03.2014 / 18:29
1
answer

PostgreSQL - Add existing values of the current Month

Good staff I have a table with date column of certain records. I know to add up the records for a given day: SELECT SUM(CAST(REPLACE(coluna1,',','.') AS DOUBLE PRECISION)) FROM tabela1 where CAST(data as date)=current_date and xxxxx='111111...
asked by 14.04.2014 / 11:50