Questions tagged as 'select-limit'

2
answers

Clause similar to MySQL's LIMIT in MSSQL

I need to run the query below in PHP with SQL Server, however I can not use the LIMIT clause missing in Microsoft queries . $SqlTabelaAtual="SELECT * FROM BusinessCadTabPreco RIGHT JOIN BusinessCadTabPrecoItem ON B...
asked by 15.01.2016 / 15:17
3
answers

RETURN THE SUM OF MAXIMUM 3 VALUES IN SQL

I have a table and need to return the following: check based on the recipient column, add up the 3 largest amounts of that recipient, bring in the query only if the sum of the 3 largest are > = 1024: CREATE TABLE TRANSFERS( SENDER VARCHAR2(...
asked by 12.06.2018 / 19:56
1
answer

ORDER BY or LIMIT. What is first processed in SQL Select?

Friends, what is first processed in SQL Select? The "Order by" or "Limit"? For example, if I have a table with multi-state cities. Then I look for cities with more than 100 thousand inhabitants of state X, resulting in 6 cities (eg cities lis...
asked by 07.06.2018 / 09:27
1
answer

How do I return the records between two values with the SQL Server Database?

Example of my table: My question is as follows ... In my news page highlight has to appear the 2 latest news and on the secondary news page have to appear the 2 other news following. Example: in the highlight the news that will appear are...
asked by 13.10.2016 / 23:40
1
answer

doubts with entity and limit

I need to search the last 100 records of the bank, I am using the following code, but it returns the first 100: dynamic data = null; try { data = limit == 0 ? (from p in contexto.Set<TEntity>(...
asked by 12.09.2016 / 17:16
2
answers

PostgreSQL - Query data from a range and bring a boundary of more spaced lines

Good morning guys, how are you? I have a performance problem on a system and need to solve customizing a SQL. Let's imagine the following scenario: - A table with millions of records, each record has an ID (PK) and a TIMESTAMP. I curr...
asked by 31.03.2016 / 15:39
0
answers

I need to limit results of each column in 4 items only in MySQL

I'm using this select SELECT * FROM (SELECT * FROM clientescontatos t1 WHERE codcliente = 'teste' AND tecnicoFlag = 1 LIMIT 4 UNION ALL SELECT * FROM clientescont...
asked by 04.07.2018 / 20:55
1
answer

Mysql SELECT with JOIN and LIMIT in child table

Hello, I would like the help of the collaborators. I have a table "catalog" related to another table 'images'. Each record in "catalog" has n pictures. I need in a SELECT with INNER JOIN images, only 3 images are returned for each row of the cat...
asked by 16.04.2017 / 02:59