Questions tagged as 'sql'

2
answers

Slow query PHP MySQL

I have a problem of slowness when making a query to the bd, it is from a friend's website and I do not have much idea of php but the section that makes the query is the following code. function get($id_usuario=false){ global $wpdb;...
asked by 05.06.2017 / 19:14
2
answers

IF conditional in SQL query

I am developing a Java web application in NETBEANS and I have a query which shows numerical values only, when I execute my query it shows them in an organized table, everything works perfectly. What I want to do are 3 conditions "IF" with the...
asked by 17.04.2017 / 18:46
2
answers

Case mysql error

SELECT count(*), CASE count(*) WHEN >=0 then Esta vacio end FROM producto By putting this query I get the error #1064 - Algo está equivocado en su sintax I have been reading online and I can not find the solution to this problem   ...
asked by 26.04.2017 / 11:16
2
answers

What is the correct way to pass a date as a parameter?

I always have problems with dates when wanting to pass them as a parameter to a SQL statement, I try to use a previous variable, a Convert or a Cast but I never find the correct way. I have the following statement in C # where I...
asked by 18.05.2016 / 19:47
4
answers

How can I get the latest registration by date and time

I would like to obtain the last value registered in a table, there are two columns in my table DATE and TIME. How can I consult the database so that I can return, for example, the data '8' of the value column?    Structure of my table id_l...
asked by 26.09.2018 / 02:13
2
answers

Difference between query () and execute () [duplicate]

It really is the same: $base->query("DELETE FROM EJ_TABLA WHERE ID='$Id'"); What to do this: $base->prepare("DELETE FROM EJ_TABLA WHERE ID='$Id'")->execute(); ?     
asked by 21.08.2018 / 14:26
4
answers

How do I get this date format in Sql Server 2014?

I am having problems when formatting a date in SQLSERVER, my query is SELECT CONVERT(VARCHAR(10), FECHA_INI_FALLA, 13) AS FechaFalla and the result I get is 12 SEP 2017 and what I want to get is 12/SEP/2017 O 12-SEP-2017 It should...
asked by 12.09.2017 / 18:48
1
answer

Search for a string with _ in sql

I have to make a query against a table in a SQL Server 2014 database, the problem is that I have to search for the string _ _ _ (three followed without spaces / strong>, I put it that way because it edits it to me) and since the character _...
asked by 27.06.2017 / 11:56
1
answer

How do I add a query within a CASE in mysql?

I have the following query : select 'preguntas'.'tipo', 'preguntas'.'puntaje', 'preguntas'.'descrip', 'preguntas'.'numero', 'preguntas'.'v_f', 'preguntas'.'seleccion', 'preguntas'.'desarrollo', CASE 'preguntas'.'tipo' WHEN 2 THE...
asked by 06.07.2017 / 06:25
1
answer

Detect DOCTRINE date collisions

I have a table TAREAS formed in the following way: +--------+------------+---------------------+---------------------+ | id | informe_id | inicio | fin | +--------+------------+---------------------+----...
asked by 20.07.2017 / 10:59