May 20, 2014 at 3:18 am
hello,
i have one question thanks for answering
select conut(*) as type
from tblname
where group=a
union all
select conut(*) as type
from tblname
where group=b
Result
15
20
but i want Result diplay like
type | group
15 a
20 | b
May 20, 2014 at 3:30 am
I assume you mean Count...
select COUNT(*) as [type], [group]
from tblname
where group in ('a','b')
Group by [group]
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 20, 2014 at 5:11 am
thanks GilaMonster, its correct
select COUNT(*) as [type], [group]
from tblname
where group in ('a','b')
Group by [group]
but haw use
where group in ('%a%','%b%')
i can use it
May 20, 2014 at 5:50 am
bbf.kurd (5/20/2014)
thanks GilaMonster, its correct
select COUNT(*) as [type], [group]
from tblname
where group in ('a','b')
Group by [group]
but haw use
where group in ('%a%','%b%')
i can use it
WHERE [group] LIKE '%a%' OR [group] LIKE '%b%'
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply