28/07/2012 Development / links

http://www.dpriver.com/pp/sqlformat.htm

Ex: SELECT top 20 venda, aluguel, cod, referencia, n_vagas, quartos, bairro, format(valor,'R$ ##,###,###') as valor, txtCategoria, cod_tipo, (select count(*) from tabMedia B where B.codImovel = A.cod) as totalFotos FROM tabImovel A inner join tabCategoria on A.cod_tipo = tabCategoria.idCategoria where (destaque = 1 or lancamento = 1) and publicar = 1 and flagExcluir = 0 and A.cod in (select tabMedia.codImovel from tabMedia) ORDER BY referencia

Gostei!