Most voted "where" questions
81 questions
Sort by count of
-
0
votes1
answer440
viewsSelect Union same table
Could anyone help me with this problem? The query below throws the following error: #1054 - Unknown column 'u.idocorrencia' in 'Where clause' SELECT DISTINCT * FROM( (SELECT o.*, u.nome AS…
-
0
votes2
answers204
views -
0
votes0
answers391
viewsLaravel query using SQL tags Like, Where, and, or
Good afternoon guys I’m having a problem because I need to make the following representation of consultation in Aravel SELECT * FROM imovels AS i INNER JOIN estados AS e ON e.id = i.estado_id INNER…
-
0
votes1
answer39
viewsSelect deleted a record and searching for others with the same code
The product code I pass to sql via php. For example $cd_product = 2; I would like to list everything but the product record (cd_product != 2). So far so good. However I would also like only the…
-
0
votes1
answer168
viewsQuery 2 tables in a sql database and display repeated values
I have 2 tables in my database, a call pessoas and another call resultado, I am filling the table result with the draws made by mega sena, the table result has the fields: data, dez1, dez2, dez3,…
-
0
votes2
answers98
viewsRepeat condition in WHERE at the time of query
Currently use WHERE coluna IN (1,2,3,4) in my consultation. Only I realized that the IN works as a kind of "OR", it generates me a small problem, because the ID are features of a product. These…
-
0
votes1
answer410
viewsMysql, use SUM(total) > 10 quantity in WHERE
I have the following MYSQL query: SELECT SUM(A.val) AS totalvendas, B.cod AS codigo, B.nom AS Nome, B.reg AS regiao FROM venda AS A LEFT JOIN vendedor AS B ON A.ven = B.cod WHERE reg = "norte" GROUP…
-
0
votes1
answer52
viewsHow To Use Where IN in Query
How can I perform a query below with mysql in the: SELECT gps.positions.id, gps.positions.protocol, gps.positions.deviceid, gps.positions.servertime, gps.positions.devicetime, gps.positions.fixtime,…
-
0
votes2
answers512
viewsSelect/Where with parameter does not work on Oracle
I am making a select with Where via PHP and Oracle, when it receives an error by the parameter occurs: Warning: oci_execute(): ORA-00911: invalid Character in C: xampp htdocs project includes…
-
0
votes1
answer44
viewsWhy is my WHERE statement in Mysql not working?
I have the SELECT below, and in the WHERE clauses the amount of credit would only be shown if >= 2, but even putting the condition, shows me everything. (fornecedor_credito.qtd_credito >= '2')…
-
0
votes2
answers2541
viewsHow to make a select inside another select in mysql
I need to take the lowest value of a column to use it as a condition in where, but I don’t know how to do that. The column I need is the ordering, as below: SELECT p.pro_name, p.id, f.image as foto…
-
0
votes1
answer697
viewsHow to perform a search disregarding Firebird special characters in the WHERE Clause
I’m making a View and Clause WHERE it does not accept a filter of this 'Temporary' only if removing the accent Ex: 'Temporario'. CREATE VIEW VWORDEMPRODUCAO ( CODEMPRESA ) AS SELECT F002 AS…
-
0
votes1
answer20
viewsSQL query with OR gets slow
I have an appointment that does the search using: WHERE pt.product_name LIKE '%termo da busca%' Then I want the search also look for the artist’s name and put: WHERE pt.product_name LIKE '%termo da…
-
0
votes1
answer63
viewsSQL "Where" problem
I am doing a query in SQL and as a constraint I want the query to return the data from the first day of the previous month until today. For example: If I run today (10/04/2019) the query, will…
-
0
votes0
answers21
viewsSlow MYSQL query, when searching for date
I’m doing a date search on mysql, but it gets very slow (more than half a second). Is there any way to optimize this search to get faster? Ex: of consultation: SELECT dt.data,count(d.id) AS…
-
0
votes1
answer38
viewsfilter between two dates with Join
I have two tables: col (collaborator) and Indicacao. I made a select to know how many referrals each employee has. It’s working but I can’t filter by date using between. SELECT c.id, c.nome, funcao,…
-
0
votes0
answers28
viewsI want to make a select in my database to see all the results that are: status = 1
$sql = "SELECT * FROM pagamentos WHERE status = 0"; while($aux = mysql_fetch_row($sql)) { echo '<td>'. $aux['nome_cliente'] .'</td>'; } …
-
0
votes2
answers198
viewsConditional help in SQL WHERE
Come on, guys, I’m putting together an SQL query. In this query, the field SD1010.D1_TES can assume N values, but if this field is equal to empty, I need one more restriction to be applied…
-
0
votes1
answer217
viewsMYSQL - SUM within IF
Good morning guys! All right? I took a look and found nothing about it... If it’s repeated topic, I’m sorry.. Situation: I need to filter the "conditionals" by status, but these status I define from…
-
0
votes1
answer54
viewsSelect 2 wheres in a query with more than 1 table - PHP, SQL
I am developing a legal system for registering processes and that can be shared between the users involved. At the moment, I need to filter processes between dates. I already managed to do this…
-
0
votes0
answers47
viewsMYSQL - Query, Find last values of a database based on the day and time of the record with an Inner Join
good afternoon... I need a help from the noble programmers of this forum to solve a small bug (I say I’m not a programmer, I’m curious). I have 2 databases, the first database is dynamic, it…
-
0
votes2
answers71
viewsHow to do WHERE with an incomplete name to find the record that in the bank is with the full name?
Hello, I need to get the system to email the registered person on a form as the engineer in charge. Then I need to make an SQL that looks for the email from the name. So far ok. If the person type…
-
0
votes1
answer73
viewsDoubt with LEFT or INNER JOIN and WHERE SQL Access
all right? So, I have this query here in Access: SELECT tbl_produtos.NomeProduto, tbl_produtos.PrecoVenda, tbl_precos_especiais.PrecoVenda FROM tbl_produtos LEFT JOIN tbl_precos_especiais ON…
-
0
votes1
answer17
viewsHow to add the WHERE condition in the SELECT table with server-side Processing?
I wanted to add a small SELECT condition to my table, but I am using the Datatables server-side Processing to list the records on the server side. I tried to adapt the standard Datatables code to…
-
-1
votes1
answer58
viewsQuery using WHERE
I need to make a query in a table called controls: I have the spine CH which is the workload in minutes and I have the column SETOR which are the sectors that have participated in some training. I…
-
-1
votes2
answers849
viewsCondition within the WHERE clause
Good afternoon ! I have a task to perform a select, but the parameters are passed as variables and I need to treat the input of one of these variables with the following logic: if &CT is not…
-
-1
votes1
answer32
viewsScan 4 selects and display message
Speak up, people, blz? I would like to know how to make the following logic in SQL: if( 1 = select * from tblA or 1 = select * from tblB or 1 = select * from tblC or 1 = select * from tblD or )…
-
-1
votes3
answers64
viewsHow to filter only numbers with 'Like' SQL
I have a table in which the field mainUnitId has the following data: Ad23 Ad7 Ad11 Ad9 Adv1 Adv14 Adv21 I need to bring in the search only those who have Ad + numbers after My code: SELECT * FROM…
-
-1
votes1
answer179
viewsFilter information from a CASE WHEN SQL and only results that contain all information
I need to return only the result that contains all the information that in the case of this image and the ID='8187' Select d.ID, d.post_title, d.post_type, MIN(CASE WHEN b.name = 'Resinas' THEN…
-
-1
votes1
answer28
viewsProblem with SQL return
I have a table that connects two other tables. "Request" it links "Customers" and "Solitation_description" It has the cliente_id link columns and request_descricao_id, I need to return clients who…
-
-3
votes2
answers81
viewsHow to use WHERE function in column created from a query?
select a.campo1, b.campo1,replace(replace(b.campo1,'-',''),'.','') as resultado from dbo.tabela1 a, dbo.tabela2 b where a.campo1 = resultado I am trying to select above, but it displays error…