11
I am working with PHP and have about 8000 records currently on DB.
As it is for a web page, I need to make a pagination to be able to read the data.
From what I understand, I have to do something similar to limit
and offset
to show from 50 to 50 pages, but don’t know how to do this with SQL Server.
I need it to work with Join below:
select os.id,
os.dataHora,
material.nome as nomeEquip,
cliente.nomeFantasia,
setor.nome as NomeSetor,
os.motivoOs,
(select sum(itemMaterial.valorUnitario) from os as OS1 inner join
itemMaterial on itemMaterial.id = os.idItemMaterial
where OS1.id = os.id ) as TotalMaterial,
tipoOs.nome as NomeTipoOS, itemMaterial.nSerie, itemMaterial.rm, os.status from os
inner join itemMaterial on itemMaterial.id = os.idItemMaterial
inner join modelo on modelo.id = itemMaterial.idModelo
inner join material on material.id = itemMaterial.idMaterial
inner join cliente on cliente.id = os.idCliente
inner join setor on setor.id = os.idSetor
inner join usuario on usuario.id = os.idUsuarioSolicitante
inner join tipoOs on tipoOs.id = os.idTipoOs
where cliente.id = (select usuario.idCliente from usuario where usuario.login = 'julio')
order by dataHora desc
How to proceed in this case?
Link util: http://stackoverflow.com/questions/2135418/equivalent-of-limit-and-offset-for-sql-server
– novic
What is the doubt?
– Wallace Maxters
Could Fabricio explain a little better what result you want to get? Or do you just want to know the equivalent of Limit and Offset for sql-server?
– Bacco
@Bacco. I’m working with PHP and I have 8,000 records. You already know how it looks on a web page. I want to make a pagination. From what I understand, I have to do something similar to limit offset to show from 50 to 50 pages.
– fabricio_wm
I took the liberty of transposing this to the question to be clearer, check the history of amendments: http://answall.com/posts/168260/revisions
– Bacco