Questions tagged as 'sql'

1
answer

Separate rows by group and their percentage of total

I need to get the top 10 results in my table and their respective percentages, separating by groups. For example the table: +-----+-----+ |id |fruit| +-----+-----+ | 1 | or | | 2 | ban | | 3 | or | | 4 | or | +-----+-----+ It w...
asked by 26.12.2014 / 23:40
3
answers

Problems with LEFT JOIN

I'm breaking my head a few days ago with SQL on something that should be pretty simple, but I can not figure it out. I want to get all the data in the [NumOrdem] table including those that are not in the [ItemNotes] table with the following S...
asked by 10.12.2014 / 20:53
2
answers

Insert the last data of a table into a second table

I have a problem with INSERT in PHP. I have a table named products_1 and another called products_2. Table 1 has the same products as the second, but with 5 more products, ie ID 11, 12, 13, 14 and 15 are not inserted in products_2. I need to "cop...
asked by 08.12.2014 / 14:57
1
answer

Error in Sql Server: is not a recognized function name

I have two functions in the sql server that are not being recognized by the database -- Não loga conexões de usuários de sistema IF (ORIGINAL_LOGIN() IN ('sa', 'AUTORIDADE NT\SISTEMA', 'NT AUTHORITY\SYSTEM') OR ORIGINAL_LOGIN() LIKE '%SQLServe...
asked by 15.04.2016 / 17:28
1
answer

Generate bank backup via application

In my project, I connect to the database. Is there any way I can back up my database via ASP.NET MVC 5 and save that backup directory, either in the project root or in a folder in a more secure place? The database I use is SQL Server Ex...
asked by 27.11.2014 / 13:28
1
answer

How to do search and show data

Well .. I need to do a search on a table and through that search pull the data from another. But I ended up losing myself in logic ... Example of what I'm doing: The user informs the data he wants: <td > <font >No...
asked by 22.08.2014 / 16:41
1
answer

Relation between 3 tables mysql

I'm trying to make a relationship between three tables. I have the tbl_eventos table that will be a table where you will save the event and its date. The tbl_servicos_extra table will save extra services that can be added to the ev...
asked by 24.07.2014 / 12:47
2
answers

Sorting by date in MySQL

I have a table with two fields: dh_premium_expires and score .    dh_premium_expires - the date / time the user's premium will expire.       score - in-game user score. On my site I have a list where I can list these users,...
asked by 01.04.2014 / 13:17
1
answer

Multiple Bank Login Control

Well, I have my application and every client will have their own database. As each client will have its database, it will also have its user table for login. So I have BancoEmpresa1 - User / Password: [email protected]/123 BancoEmpresa2...
asked by 21.03.2014 / 15:07
1
answer

Add values from within a column with postgres

I'm trying to sum the values from within a column with postgres, the structure of the table is as follows: id |nome_municipio |valores 1 |Porto Alegre |100.01;95.0;50.1 2 |Ivoti |87.0;80.1;45.1 3 |Novo Hambur...
asked by 29.01.2015 / 03:11