Questions tagged as 'sql'

1
answer

Create select with multiple fields

How to create a select that makes the relation of at least 03 tables and present a field of each table at least?     
asked by 21.06.2016 / 01:14
1
answer

Do select searching for the 3 highest values

I have a table that has the following data:    id_indication, id_user, lg_client A user can indicate multiple clients (lg_client = 1) , would like a select that searches the 3 users who indicated the most, ie the three id_user that t...
asked by 31.12.2015 / 11:17
2
answers

Limit number of occurrences of Group By

I have to search in a data table of an advertiser, I need to group by advertiser according to the most viewed, separated by date. I wanted to limit group by , how? Example table: id visualizacoes data 485 19...
asked by 28.05.2015 / 14:44
1
answer

Query Linq with count

I am making a query that has some joins and a count, however I want to do it with Linq . This is my Query. sbSQL.Append("SELECT grproj.cdgruproj as Id, grproj.dsgruproj as DescricaoGrupoProjeto, "); sbSQL.Append("(SELECT...
asked by 06.04.2015 / 16:31
2
answers

Storing unit of measure in MySQL table

In one of my forms it will be necessary to collect the height of the user in meters. However, this form may be in English or Portuguese. If it is in English this height will be in feet. If it is in Portuguese, the height will be in meters. Th...
asked by 16.04.2015 / 17:54
1
answer

Return values for all months of the year by drawing per month

I have the following SELECT: SELECT coalesce(sum(vs.total), 0) FROM tabela_exemplo t WHERE extract(year from t.data_entrada) = extract(year from current_date) GROUP BY extract(month from t.data_entrada); What returns the following result:...
asked by 20.10.2015 / 21:13
1
answer

Is there a way to know the name of the Database Server

Is there a sql commando that can inform the server and database where the select is running? I am available for more details     
asked by 07.01.2016 / 12:07
1
answer

Select by taking the difference between SQLite dates

I wanted a select that gave me the following sentence comparing two dates, for example: "2015-03-12 13:00"e "2015-03-12 14:15" . My return would be something like:    0 days left 1 hour 15 minutes to ... I need this in a sql retur...
asked by 21.02.2016 / 20:39
2
answers

How to bring the conditions entered as parameters into the SELECT result?

Is there any way to get the parameter values used in the SELECT clause in the WHERE result? Example: SELECT a.*, cast(:dataIni as date) AS inidate , cast(:dataFin as date) AS inidate FROM mytable a WHERE a.date BE...
asked by 02.08.2014 / 19:03
3
answers

List all months in an interval, or query or schedule?

I'm making a chart that lists a certain amount per month, but you can have more that has nothing, so it does not return any value and does not list it on the chart. I do not know if I should change the query or programming, can anyone help me...
asked by 12.08.2014 / 15:50