test sql


Please login or register to vote for this query.

(click on this box to dismiss)

Joomla Meta

Q&A about the site for Joomla! administrators, users, developers and designers

declare @table table
(mark int, 
name varchar(10), 
cost int, 
salecategory int, 
costcategory int)

insert @table values(10, 'pete', 20, '9', '8')
insert @table values(10, 'pete', 20, '9', '7')
insert @table values(15, 'pete', 20, '5', '6')
insert @table values(10, 'pete', 56, '6','2')
insert @table values(15, 'John', 10, '7','3')
insert @table values(20, 'John', 10, '2','1')
insert @table values(20, 'John', 10, '1','1')

count (distinct(case when mark=10 then 6 else null end)) as pv,
count (distinct(case when mark=20 then 8 else null end)) as pc

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results