Questions tagged as 'sql'

2
answers

Query does not sort records by Asc / Desc

I have a table called cadcha (call register) in the database where all the calls made by the employees of a certain company are stored. cadcha -------------------------------------------------- nreg |telefone |telpretot |ramaldest...
asked by 16.12.2015 / 13:45
1
answer

INNER JOIN Performance in SQL

Hello, could anyone tell me if there is any significant performance difference in the two ways of doing INNER JOIN below? Way 1: SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name; Way 2: SELEC...
asked by 17.12.2015 / 19:42
1
answer

Result update from another table

I have the following SQL: SELECT id_grade ,MAX(data_lancamento) FROM faturamento_produtos WHERE data_lancamento < '01-01-2010' GROUP BY id_grade Where it does the search only for what was released before 2010. I have another...
asked by 04.03.2016 / 19:25
1
answer

Field alias in oracle where clause

I have a Decode in my select like so: ..... DECODE(MAT.IND_TIPO_MAT_MED, '1', 'BRASINDICE', '2', 'SIMPRO', '9', 'TABELAPROPRIA') TIPOTABELA, ..... I need to pass these values on the where clause, sinc...
asked by 13.01.2016 / 13:49
1
answer

I should not display negative results

I put a query where I bring some information, of which the last column returns positive, negative and zero values. I do not want to display the rows with negative values, but I'm not sure how to do that. This is Query SELECT C.SG_CONCESS...
asked by 31.07.2015 / 22:08
1
answer

Query with INNER JOIN and choose loop reference

Now, I'm querying two tables with INNER JOIN like this: if (! $db->Query("select * from cad_produto inner join cad_variacoes on cad_variacoes.id_produto = cad_produto.id")) $db->Kill(); while (! $db->EndOfSeek()) { $row...
asked by 21.08.2015 / 18:10
1
answer

Error starting PowerShell in Windows Server 2008 R2. How to solve?

I have installed SQL Server 2014. When I start PowerShell on Windows Server 2008 R2 and do the "sqlps" command to test, this error occurs which shows in the image below ... On another computer, with windows 7 and the same version of SQL Serve...
asked by 20.08.2015 / 21:25
3
answers

Return the id of a table in another table

I have a clients table containing CLIENT_ID, CLIENT_NAME, and another table containing CLIENT_APROVED. The approval table is populated with SOME clients of the clients table but only the NAMES of the clients. I wanted to replace the name with...
asked by 03.07.2015 / 19:41
1
answer

Mounting a SQL for School Bulletin?

I'm trying to put together a SQL to display the results of a School Report Card. In the notes table I have the data as follows. Table Notes MATERIA | NOTA | PERIODO PORTUGUES | 5.0 | 1Bim PORTUGUES | 10.0 | 2Bim PORTUGUES |...
asked by 25.10.2015 / 03:29
1
answer

How to bring value null query Sql server

I have a sql query where it brings the total of a value entered into a date, however I want to show in the result the dates that generated zero, even though it does not contain information in the database, I always search in a period and the day...
asked by 06.10.2015 / 19:37