Questions tagged as 'query'

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 return data array with join in Laravel with DB class?

I need help with this SQL of Laravel : $process = $db->table('processo')->where('nrprocesso',$id) ->leftJoin('viatransporte', function($viatransporte){ $viatransporte->on('processo.idviatransporte', '=', 'viatra...
asked by 19.03.2017 / 16:03
1
answer

List the owner of the post and the last user who commented. Mysql

Hey guys, I have the following query below, where I list all posts, number of comments and the user who created it, but also wanted to list the last user who commented on each post, can you do all this in just a query? SELECT post.titulo, COUN...
asked by 05.02.2017 / 15:07
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
1
answer

MongoDB: Projection of only one element of an array nested to another array nested to an object

I have the following situation: I need to query a document with a projection that returns only the first element of a list. But this list is inside another list, and that other list is inside an object that is inside another object in a document...
asked by 15.12.2016 / 22:02
1
answer

Doubt in a Query that does SELECT on two tables

Good afternoon, I am doing a system of scheduling equipment, for better understanding I will put in topics some important information. Each schedule has a numbering of the equipment that will be used in that time range. You can not use two...
asked by 01.12.2016 / 15:39
1
answer

List by foreign key MySQL and Java

I'm trying to select the dvds that the member registered but I'm not getting it, I would like to know if someone can help me, the result of my code returns so Result: 1 - null - null - null - null - null - null - 2 And only one result appea...
asked by 31.05.2015 / 00:41
1
answer

0097 - missing parentheses to the right. - Can help

I know there are some discussions here in the forum about this error 0097 - missing parentheses on the right .. Here is my command, can you help me? select distinct Coalesce(Sum(Case When FI_TITULO.ABERTOQUITADO = 'Q' Then 0 Else (FI_TITULO.VL...
asked by 21.09.2018 / 15:05
1
answer

Query error when using 1 where and 2 joins in Query Search

Hello, I'm running the following query in mysql: select * from usuarios where login='gamboamurilo' or email='[email protected]' and senha='8b0a60f71e758c8b27e7688ee754cd85' inner join permissoes on usuarios.permissoes=permissoes.id inne...
asked by 17.09.2018 / 02:01
2
answers

When inserting the result of a query, inserting only the first row

I'm bringing a query from one bank and I'm going to insert it into another one, this is running the question and it's only inserting the first line and not all the results, see my script below: <?php $host="192.168.0.249"; $por...
asked by 20.09.2016 / 17:35