Questions tagged as 'sql'

2
answers

To do a complex search would I have to use OR to combine all instructions?

I would like a help to make the SQL according to the data of this figure. What I know is that if I send AND to all characteristics and one of them returns false or erro all SQL is compromised. I thought about doing thi...
asked by 06.10.2014 / 18:41
2
answers

Why this SQL syntax error?

$termos = (explode('/', implode('/', $_GET['tipo']))); print_r($termos); Array ( [0] => CASA [1] => CASA EM CONDOMINIO [2] => COBERTURA ) I'm having a syntax error in this SQL that makes loops to add as many terms as need...
asked by 04.10.2014 / 18:03
1
answer

How to do foreign table associate fields using select? [duplicate]

In my project I have a function in which I search all elements of the database and still causes "categoria_id" to become "categoria_nome" requesting the field in another table, however when I try to use this select I again...
asked by 18.08.2017 / 03:10
1
answer

Receive variable value and insert multiple rows in MYSQL

I have the following variable: $ids = "758,749"; The table has the columns: id, provider_id, accept. When running a PHP script, I would like it to do something like this: INSERT INTO tabela (id, id_prestador, aceite) VALUES (null, $idd...
asked by 09.08.2017 / 18:22
2
answers

How to make a query using SQL correctly SUM

I have the following query: SELECT YEAR(NFDtEmis) AS 'Ano', MONTH(NFDtEmis) AS 'Mes', ItProduto AS 'Produto', SUM(ItQtde) AS 'Quantidade total' FROM NotasItens INNER JOIN NotasFiscais ON NFEmpresa = ItEmpresa AND NFNumero = ItNfNu...
asked by 03.08.2017 / 20:53
2
answers

Export SQL Server Database 2014

I need to export the SQL Server database to send to a friend. But I'm not getting it, I wanted to know if I copy these files and send them to him, if it will work on his SQL Server (I do not know what version of it). C: \ Program Files \ M...
asked by 07.10.2015 / 04:28
1
answer

Sql Query, fetch data from given id [closed]

How to make a query, searching for data from the given ID? For example, my table has 1mil records, I want to determine in a foreach the search of the data from the 300 record.     
asked by 24.01.2017 / 22:37
1
answer

Delete multiple SQL Server rows that have the same text snippet?

To test my forms, I ran several fills with the word "test" in the fields. Now I wanted to clean the DB, but I'm having trouble deleting multiple lines with the same stretch of "test" text I am applying the following command, but no row is aff...
asked by 18.12.2018 / 17:49
1
answer

How to get the last record to the first

I have these names in my table: nome ----- A B C D E F If you do: SELECT nome FROM tabela It will return me "A, B, C, D, E, F" . I would like it to come back from the last record to the first.    F, E, D, C, B, A. How coul...
asked by 17.12.2018 / 14:03
1
answer

red / negative and green / positive

I have a table that, time value is negative, and time is positive. I would like these values to be green or red. But I could not do that. Currently my select is being rendered this way: (php, myadmin, pdo) <?php $sql = $pdo->pr...
asked by 01.01.2019 / 00:25