Questions tagged as 'sql'

2
answers

Select comparing current date with exact date 1 month ago

I made this select that returns me the amount of records in the last 24h select count(*) from registros where registry_date >= NOW() - interval '24 hours' I need a select that compares the value that is returned in this first query with...
asked by 10.10.2018 / 16:34
2
answers

Doubt in the insertion of data realizing the relationship in another table

I'm trying to insert an Address into the adresses table and refer to a User already registered without Address in the user table, through the _id that is generated when I enter an Address. Return this _id and insert it into the adresses_id colum...
asked by 10.10.2018 / 18:26
1
answer

SQL Server 2017 - Retrieve column description / comment on table in database - Metadata

I am trying to generate a data dictionary from my database in SQL Server 2017, and would like to retrieve the description / comment from the 'Description' field contained in the column definitions of each table. I was inspired by a code I found...
asked by 05.10.2018 / 19:35
1
answer

SQL Server 2017 - SELECT with Duplicate Metadata

I made a select using metadata, but the result of my selection brought me something like a 'Cross Join'. Even using GROUP BY and DISTINCT returns with the duplicate values. I would like a help for the values to return correctly ... follows the s...
asked by 05.10.2018 / 21:14
0
answers

SQL Management Studio only connects remotely without the instance

When trying to connect to a remote first SQL, I noticed that my Management Studio could not connect using the instance, as follows: Afterthisattempt,Iremovedtheinstance,andasthisserveronlyhasaSQL,ittookthedefaultsystem,andloggedinnormallywit...
asked by 04.10.2018 / 16:31
0
answers

Error in query - Inconsistent data NCLOB

Hello, I'm trying to perform a query on an Oracle database and it is returning an error    ORA-00932: Inconsistent data types: expected - got NCLOB   00932. 00000 - "inconsistent datatypes: expected% s got% s"   * Cause:   * Action: T...
asked by 03.10.2018 / 20:52
0
answers

Function to return total sales

I have this function that returns me the amount of sales of a cnpj month to month in the year 2018, I would like it possible for someone to help me implement a variable in this function, to get the total for cnpj in the year and show how a colum...
asked by 08.10.2018 / 17:50
1
answer

Group SQL results by date

So, I have a table that registers the login of the players, all the values in unix timestamp, and I wanted to know how I can know the day when there were more records, and adding the total, the day that there were more SEG_Online , AJ_Envadas an...
asked by 07.10.2018 / 20:47
1
answer

Field to number or rank different records - Oracle

I have a problem that is as follows: Knowing that a service can have several exams, I need to number the exams in order to know the first, second, third ..., for each service. Example: LINHA ATENDIMENTO SEQ_EXAME 1 100...
asked by 16.10.2018 / 12:55
2
answers

Selection top 3 where distinct

Good afternoon guys. link I need a help, I tried to see in the session above but I could not solve my problem. My problem is as follows, I need to make a selection of products and all of them separated by vendor, for example. Imagi...
asked by 02.10.2018 / 22:21