Jump to content
jafm

[Resolvido] colocar unidade na query

Recommended Posts

jafm

Boas,

Estou a tentar fazer este select

SELECT top 10 Nome, Count(Cast(LOJA as nvarchar)+' imi' ) as total

Só que não está a passar o resultado pretendido não aparece imi à frente do resultado.

Share this post


Link to post
Share on other sites
Caça

Isto?

SELECT top 10 Nome, convert(nvarchar, Count(LOJA))  + ' imi' as total

Edited by Caça

Pedro Martins

Não respondo a duvidas por PM

Share this post


Link to post
Share on other sites
jafm

Ok,

A minha query é antiga , ou seja, sem unidade de medida é esta

--SELECT Site.Nome, Cast(COUNT(Cliente.LOJA) as nvarchar) +' imi' as total 
SELECT Site.Nome, COUNT(Cliente.LOJA) as total 
FROM Cliente INNER JOIN
Site ON Cliente.LOJA = Site.Loja
Group by Cliente.LOJA, Site.Nome
order by total desc

o que eu pretendo é colocar as frente de total a unidade de medida exemplo 'imi'

Share this post


Link to post
Share on other sites
Rechousa

Isto deverá funcionar.

SELECT Nome, CAST(Total AS NVARCHAR) + ' imi' FROM
(
SELECT TOP 100 PERCENT Site.Nome, COUNT(Cliente.LOJA) as total
FROM Cliente INNER JOIN
Site ON Cliente.LOJA = Site.Loja
Group by Cliente.LOJA, Site.Nome
order by total desc
) A

Edited by Rechousa

Pedro Martins

Sharing is Knowledge!

http://www.linkedin.com/in/rechousa

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.