Questions tagged as 'sql'

3
answers

Return the row of a table when the value of count (field) is 0 in MySQL

I need that even when the search does not generate results, the value 0 is displayed, I tried with the following SQL search, but without success: SELECT c.categoria as categoria, CASE WHEN COUNT(c.categoria) IS NOT NULL THEN cou...
asked by 11.03.2018 / 02:25
1
answer

How to get id of a CRUD element [CodeIgniter]

My question is this: I have a CRUD made in CodeIgniter , but the table rows are not in the localhost/crud/produtos/[:num] format. In the last column of the table you have action buttons to edit and remove, one for each row. How...
asked by 05.03.2018 / 20:50
1
answer

Procedure to increase return date

I have the following table: CREATE TABLE Emprestimo ( id int PRIMARY KEY, dataRetirada date DEFAULT current_date, dataPrevistaDevolucao date DEFAULT current_date + 7, dataDevolucao date, codigoUsuario int, codigoExemplar int, FOREIGN K...
asked by 23.04.2018 / 05:41
1
answer

group per SQL query

I have a post table with a category field, each post you enter can get more than one category: post1 categoria1, categoria2 post2 categoria1, categoria3 How can I perform a sql query to join the duplicate categories and...
asked by 28.02.2017 / 19:48
2
answers

Repeat condition in WHERE at query time

I currently use WHERE coluna IN (1,2,3,4) in my query. Only I noticed that IN works as a sort of "OR", this gives me a small problem because ID are characteristics of a product. These features are selected from a menu, and I...
asked by 10.02.2017 / 23:03
2
answers

How to put ISNULL in Subselect with case?

How do I instead return Null return as Não . I'm in doubt about using ISNULL within Subselect along with the case. Result: Projeto teste Null Projeto OK Sim. Instead of Null want to return...
asked by 26.07.2017 / 16:23
2
answers

I can not connect to PHP in SQL Server 2014

Good afternoon guys! I created a small application to test my PHP connection with SQL Server 2014, but I can not connect. I have seen many forums on the web and even here some doubts similar to mine, but I still have not found the solution....
asked by 11.09.2017 / 19:47
1
answer

Run PHP within the JavaScript Function [duplicate]

function queue (id) { var idBanco = id; console.log(variaveljs); <?php $sql = "UPDATE 'tabelaclientespos' SET 'empresa' = '2' WHERE 'tabelaclientespos'.'Id' = idBanco"; mysqli_query($conn,$sqlTempo); ?> }...
asked by 02.01.2019 / 19:45
2
answers

How to set up a query to bring the last value up based on month and year?

SELECT DadosFinanceirosFiliado_Valor, Filiados_Filiado_Id, DadosFinanceirosFiliado_CompetenciaMes, DadosFinanceirosFiliado_CompetenciaAno FROM dadosfinanceirosfiliado t INNER JOIN filiados ON dadosfinanceirosfiliado.Fi...
asked by 18.12.2018 / 13:31
2
answers

Double query in 1 query

I have 2 tables one of users and one of subscribers, I have an insert that sends to the subscribers table the email of the user that registered and the name of the channel 1st users id | usuario | meucanal 1 | [email protected] | portados fundos...
asked by 31.03.2018 / 05:03