Questions tagged as 'sql'

1
answer

Select field not empty

demo table id imagem flash codigo 1 fda.jpg 2 asdfasd.sfw 3 adsense is there any way to SELECT only non-empty? if so what is the best way in PHP or SQL? $sql = "SELECT * F...
asked by 09.03.2015 / 21:57
1
answer

Problem with LEFT JOINs joins and a condition [closed]

I have had this problem for some time now. I am counting on your help. I have 3 tables: publicacao id cartaz titulo 1 eradogelo.jpg A Era do gelo 2 ojogo.jpg O Jogo 3 helpme.jpg Help Me 4 please.jpg Pleas...
asked by 27.01.2015 / 20:20
1
answer

Product upgrade issue

In query the goal is to update the product unit, with a subquery that retrieves the current drive from the database and subtracts by checking by code. UPDATE loja.produto SET UNIDADE = (SELECT (SELECT UNIDADE FROM loja.produto WHERE CODIGO...
asked by 05.09.2015 / 18:56
1
answer

How to join result of two tables 1 - n

I have the following problem. 1 client table that has relation to 1 table photos (respective client photos) relationship 1 client for "n" photos;    In short:       Client has id, name.       photo has client_id, content (bytes)....
asked by 12.01.2015 / 22:31
2
answers

Problem with UPDATE mysql

I have a problem executing an UPDATE command in my Database ... My table has 2 columns: -Column 1: link (PK) varchar -Column 2: statuz varchar I need to update only the "statuz" field in my table.    * change the value from "NEW" to "...
asked by 27.06.2015 / 09:00
1
answer

Sql query return same name with different date

My table Acidente looks something like this: Vitima - DataRegistro Pedro - 10/02/2015 Pedro - 20/03/2015 Maria - 01/05/2015 Maria - 01/05/2015 I need to make a query (Sql) that returns the records that contain: Victim's name...
asked by 22.06.2015 / 03:41
3
answers

Use query within the value of another query

Is it possible - with some syntax adaptation - to fulfill the purpose of the following query? insert into X (a, b) values(16, select c from Y where d = e)     
asked by 19.05.2015 / 21:27
2
answers

Semantical Error - Doctrine createQueryBuilder

But once I get caught using doctrine usage. I wanted to do this: SELECT c.nm_computador, c.te_ip_computador, log.usuario, log.data FROM computador c INNER JOIN log_user_logado log ON c.id_computador = log.id_computador; But I do this:...
asked by 07.11.2014 / 18:32
1
answer

How do I search for records that fit into any category in a list, even if the category name only partially matches? [duplicate]

I have this statement: $nova = (explode('/', implode('/', $_GET['tipo']))); What results in this array: Array ( [0] => CONJUNTO [1] => SALA [2] => LOJA ) When I do this query in my database ... $sql = "SELECT...
asked by 04.10.2014 / 14:49
1
answer

How to check if a name is in the database?

I want to check if a name exists in the database; if there is no registration. Using the code below I can register multiple users with the same name. cadastro.php $user = $_POST['user']; $pass = md5($_POST['pass']); if(empty($us...
asked by 21.12.2014 / 16:56