Questions tagged as 'sql'

2
answers

With SQL do order and randomize at the same time?

I have the following code: (SELECT id, slug FROM anuncios WHERE vum = '$idcategoria' ORDER BY RAND()) ORDER BY publicado DESC I need SQL to sort and at the same time randomize, except that the above code is just doing the sorting, r...
asked by 30.04.2018 / 15:59
1
answer

INSERT and INNER JOIN together in MySQL?

Hello, is it possible to use INNER JOIN together with INSERT ? I have a table A with 3 columns X, Y and Z and table B with columns W, X and Y and I need to insert table W in table A, column W? I'm trying this way but I get no res...
asked by 22.03.2018 / 18:21
2
answers

Insert in MySQL does not execute

I'm having problems in SQL when doing a small insertion in DB. I have a table with 4 fields: id_match -> int id_usuario1 -> int id_usuario2 -> int situation -> varchar(5) When I make the following insertion, it does not enter th...
asked by 23.07.2015 / 21:02
3
answers

Is it a bad practice to fill select option / option with data coming from the database? [closed]

It would be a bad practice to use selects of HTML with items fetched through a database, even if they are dynamic (always occurring addition in the table that contains them). Example without database: <select> <option valu...
asked by 10.08.2016 / 05:31
1
answer

Multiple UPDATES in the Firebird database [closed]

Can I create a method that performs several updates in the Firebird database? For example, I want to update the following registry, but it would have to be one at a time, how to update otherwise? UPDATE TVENPEDIDO SET NOTAFISCALSERVICO ='185...
asked by 04.12.2017 / 11:01
1
answer

SQL Database [closed]

Hello! I'm in training in Support and I'm having a hard time understanding the logic of select, I need to do script for example: bring the statuses of the Criteria table.     
asked by 30.08.2016 / 20:52
2
answers

Select separated by semicolons for xls

I have the following code: var cmd = @"SELECT mt.Id + ';' + mt.Nome + ';' + mt.Cidade AS Resultado FROM MinhaTable mt"; var objectContext = ((IObjectContextAdapter)db).ObjectContext; var resul...
asked by 08.09.2015 / 15:06
1
answer

I can not get the date in the table [closed]

I'm doing the following command: SELECT h.h_dia FROM hh h WHERE h.h_dia = 20180621 GROUP BY h.h_dia     
asked by 13.07.2018 / 15:43
1
answer

Is there any way to reduce if's in my code?

function updateUser($usuario, $senha, $adm){ //Atualiza informações sobre o usuário $sql_query; $q_senha = ""; $q_adm = ""; $dot = ""; if(!empty($senha)){ $q_senha = "senha=md5('$senha')"; } if($adm != NU...
asked by 21.08.2018 / 14:43
2
answers

PHP insert an array of data into a mysql table [duplicate]

I have an array in php that contains some data, eg: Array ( [nome] => Nome [sobrenome] => Sobrenome [genero] => 1 [email] => [email protected] ) And I would like to insert this data into a mySql table more automat...
asked by 03.09.2016 / 00:23