Questions tagged as 'query'

3
answers

SQL - Query on a single table with null values

Hello, I need to do a filtered query by date. The problem is that dates that do not exist in the table need to be returned by the query, having all other fields as Nulls. SELECT Data, Servico FROM controle_equipe WHERE ((Data >= #4/1/201...
asked by 03.05.2016 / 01:59
2
answers

Problem in PHP + MySQL query using LIKE

Good afternoon guys, recently in one of my projects a problem has arisen and I hope you can help me. To better understand the site is a site of consultations in the health area, such as clinics, cardiology, urology, etc. Some clinics can belo...
asked by 05.01.2016 / 19:54
1
answer

MySQL update event

I asked this question yesterday, I got the answer I wanted, I'll be direct and challenge: I have the query: UPDATE users SET time = time - 1 time is of type int and receives as default value 0 , in my PHP code I mad...
asked by 03.08.2017 / 07:35
2
answers

How to create summation with "sum" with multiple columns queryover

I need to create a query with C # queryOver (Nhibernate), to add more than one column. Example in pure sql: SELECT SUM(coluna1 + coluna2 + coluna3 + coluna4) FROM tabela First I did it this way: Tabela tabela = null; Session.QueryOver<...
asked by 05.07.2016 / 21:39
1
answer

Return tags associated with posts

I use the query below to return all posts tagged with the tag defined: SELECT imprensa_posts.slug AS slug, tipo, titulo, data FROM imprensa_posts JOIN imprensa_tags_posts ON imprensa_tags_posts.id_post = imprensa_posts.id_post JOIN imprensa_...
asked by 10.06.2015 / 20:55
1
answer

SQL Query returning duplicate records

I have a BIG problem in a SELECT: I have two Tables' adwords_performance 'and' analytics_transaction 'and I need to do a SELECT by adding columns' adwords_performance.clicks ', '< strong> adwords_performance.impressions 'and' analytics...
asked by 19.03.2015 / 21:16
2
answers

SQL query leaving a custom column data

Hello I would like to know if it is possible to mount a query that returns a table like this: The data of appB and appC comes from a select count in the Calls table that returns me the number of sessions found per application, howeve...
asked by 14.12.2018 / 14:29
1
answer

SQL Query to Group Records in MS-ACCESS

Hello, I would like a command in SQL for a query in an Access database. The structure of the table is: tbList Id | Nome | Genero | Endereco | Estado | ... The result you would like to group by state and count the number of gender (sex)...
asked by 19.09.2018 / 15:49
2
answers

Apply condition depending on value

In below, I need to use a condition only if the field is populated (line is commented out in script below). If not, this condition should not be part of query . Is there any way to do this via SQL ? SELECT DISTINCT SB2.B2_FILIAL,SB2.B2_C...
asked by 18.09.2018 / 14:48
1
answer

How to add + x to each record returned in a SELECT [closed]

For example, in a select in the database, 5 records will be returned: SELECT * FROM esc_usuarios WHERE usu_indicador_codigo = '" . $_SESSION['codigo'] . "' AND usu_situacao = 'ativo'" Then I want to assign a value for each record,...
asked by 18.10.2018 / 23:03