Questions tagged as 'sql'

1
answer

Distribute column values, SQL

I'm extracting data from a table with the following query: SELECT [nu-cpf] as CPF, [nome segurado] as NOME, '' as IdentificacaoCliente, '' as CodigoBeneficio, CONCAT([nu-ddd],[nu-telefone]) TelefoneResidencial, '' as TelefoneCelular,'' as Te...
asked by 10.08.2018 / 20:09
1
answer

Oracle- Variable without data

I have a problem and a question at the same time, I made a function to view billed requests and declare a function variable like this: select filsaida into v_loja from mov_itped where pedido= p_pedido and status <> 6; end ; When y...
asked by 28.06.2018 / 20:07
1
answer

SQL SERVER Filter

I have an exercise to do but I'm breaking my head here: "SQL command that brings me the sum of the salaries received by employee and state in the year 2014 of the tables: SALARIES / COLLABORATORS / LOCAL_DE_TRABALHO". I have already create...
asked by 02.07.2018 / 01:40
2
answers

Match table data on LinkedServer servers

I have 3 LinkedServer servers (the 3 having the same tables with the same fields). Home Server 1: First_Server Home Table: Testing Server2:Second_ServerHomeTable:Testing Server3:Third_ServerHomeTable:Testing Selecttoreturnthefieldsfromthe"Test...
asked by 16.07.2018 / 16:06
1
answer

Join tables MySQL

I have a table that has the times of the day SELECT * FROM horas ColumntypehoraisVARCHAR(5)AndaquerycontainingthetimevaluesSELECTDATE_FORMAT(date,'%H:%i')HORA,TRUNCATE(MAX(humidade),2)MAX_HUMIDADE,TRUNCATE(MIN(humidade),2)MIN_HUMIDADEF...
asked by 24.07.2018 / 20:20
1
answer

How do I make an INNER JOIN with condition?

I have the following SQL that only shows me properties that have a photo registered, as specified in the lines: INNER JOIN fotos ON imoveis.id = fotos.cod How to display properties with or without registered photos? Follow the compl...
asked by 26.07.2018 / 12:21
1
answer

LIKE with COUNT in PHP

I can not understand what's wrong with the code: $query="SELECT aluno FROM bonesmirn2 WHERE data LIKE '%2018-09%' AS faltas GROUP BY aluno HAVING COUNT(aluno) > 0 ORDER BY COUNT(aluno) DESC"; $result = mysqli_query($dbcon, $query); $numb...
asked by 04.09.2018 / 08:43
1
answer

Join SQL Tables

I have two tables: curso curso_configurar With the following structure: My question is: I need to include within the curso_configurar , the courses that will be configured, until then it is OK. However, when...
asked by 24.03.2018 / 16:47
1
answer

PostgreSQL: Catching bugs and hits

I need a query to get the number of errors and hits from this table.     
asked by 15.05.2018 / 21:41
1
answer

Select with condition

I have the following sample table (tbl_Local) in MySQL: ID| LOCAL| COR 1 | A |RED 2 | A |RED 3 | B |RED 4 | B |BLACK 5 | B |WHITE 6 | C |RED 7 | D |BLUE 8 | E |BLUE 9 | E |ORANGE 10| E |YELLOW 11| E |RED 12| F...
asked by 03.05.2018 / 21:22