Questions tagged as 'sql'

1
answer

Query query in SQL Server 2012

I need this query to come only with records where the CURVE ABC column is different from the MODEL column. For example, this customer's ABC curve is silver and the model is diamond / gold, so it turns out that the name silver is not in the mo...
asked by 09.02.2018 / 14:25
1
answer

Doubt - Case when inside a stuff - SQL Server 2012

Well, how do I put a case when exists inside the query below. The result is currently working out like this: Customers Drugstore, Soccer, Gelagua However, I want to put a case when exists if it is in the condition, come yes, yes, not come....
asked by 31.01.2018 / 20:56
1
answer

Left Join returning only 1 record for each relationship

I need to do a Join between 2 tables where I need only to display the last record of the 2nd table (only 1 record of table 2 for each record of table 1). SELECT a.Campo1, a.Campo2, a.Campo3, a.Campo4, b.Campo1, b.Campo2 FROM Tabela1 a LEFT JOI...
asked by 20.02.2018 / 21:21
1
answer

Date field display

I have a date in the American yyyy-mm-dd format and I would like to put it in the Brazilian dd-mm-yyyy format however I do not want to do as to_char conversion. I need it to continue with the date format because I will need to make filters with...
asked by 16.01.2018 / 20:16
2
answers

Select with join does not return results

I have the following tables livro id int pk passador id int pk fk_livro_id int ordem int I'm making a book listing screen. The goal is to bring all books that are not registered in the docker I made the following query: SELECT *...
asked by 25.01.2018 / 16:48
1
answer

Compare fields between two tables in PHP x MySQL

Good morning, I'm in need of some help with some tables in php. I have two tables from which I need to compare data, the tables are in a database in MySQL. The scenario is as follows: I have table1 with columns A, B, C, D and table2 with columns...
asked by 27.01.2018 / 13:18
0
answers

Loop, For, PL / SQL Cursors (Doubt)

Good morning, my doubt is as follows, my table is like this currently: Nome Idade ID João 5 Lucas 5 João 2 Lucas 1 I wish it looks like this: Nome Idade ID João 2 1 João 5 2 Lucas 1...
asked by 30.01.2018 / 14:04
1
answer

DOUBT ON SUBSELECT IN FIREBIRD

Hello, good evening! I have a table that wraps the input and output part of a box, an example of this is: On 01/01/2018 the user informed that he entered $ 200.00 in the company safe, on the same day he made another entry transaction in the amou...
asked by 01.01.2018 / 21:59
0
answers

Make a Shrink on a 2.6 TB bank [closed]

Hello, I have a SQLServer 2008 Standard R2 on a 32GB of RAM server, 5 HD 2TB making RAID5, whose database is 2.6 TBytes in size and a table uses 96% of every MDF file, as can see in the image below: Thetable" ClientType" consists of two c...
asked by 27.12.2017 / 20:12
1
answer

Use TIMESTAMPDIFF in table creation

I'm adding mysql support for my program, currently it only works with sql server, so I came across a problem with mysql. Table sql server: CREATE TABLE [dbo].[login_user]( [idx] [int] IDENTITY(1,1) NOT NULL, [client_id] [int] NOT NU...
asked by 28.12.2017 / 16:03