Viewing 15 posts - 1,186 through 1,200 (of 1,439 total)
Just for fun...
select s.Id,s.Name
from courses c
INNER JOIN school s ON c.SchoolId = s.Id
where c.Name = 'maths'
intersect
select s.Id,s.Name
from courses c
INNER JOIN school s ON c.SchoolId = s.Id
where c.Name = 'english'
April 1, 2009 at 9:22 am
select id as "info/@count",
xmlcol as "info"
from mytable
for xml path(''),root('infos')
April 1, 2009 at 8:05 am
delete u1
FROM cn_users u1
join cn_users u2 on u1.userid = u2.userid
and u1.id > u2.id
April 1, 2009 at 4:43 am
Untested, but try this
select s.Id,s.Name
from courses c
INNER JOIN school s ON c.SchoolId = s.Id
where c.Name in ('maths' ,'english')
group by s.Id,s.Name
having count(distinct c.Name) >= 2
April 1, 2009 at 4:18 am
Which ID do you want?
select name,max(id) as id
from test
group by name
April 1, 2009 at 2:28 am
GSquared (3/27/2009)
declare @XML XML;
select @XML = ' ';
select x.y.value('local-name(.)', 'VARCHAR(50)'),
x.y.value('.', 'VARCHAR(50)')
from @XML.nodes('//*') x(y);
That's sample XML, but it pulls name-value pairs from it, and that sounds like what...
March 27, 2009 at 10:10 am
May be this?
with cte(productname,turnover) as (
Select case when row_number() over (order by sum(turnover) desc) >= 5 then 'Other products' else productname end,
sum(turnover)
from sales
group...
March 27, 2009 at 3:34 am
sys.objects.name is NVARCHAR
SELECT @ssql = @ssql + 'Drop procedure ' + CAST(name AS VARCHAR(128)) + ' '
March 19, 2009 at 4:19 am
Try these
Select tablename.query('data(//XMlnode/text())')
Select tablename.query('data(//XMlnode//text())')
March 10, 2009 at 2:20 pm
This looks more like something that is handled better in your front end
select coalesce(col1,'col3') as col1,col2
from (select col1,col2,col3
from mytable
...
March 10, 2009 at 4:33 am
change
select empid, [1],[2] from (select empid, workingHrs, onDate, month(ondate) as d from rota) a
to
select empid, [1],[2] from (select empid, workingHrs, month(ondate) as d from rota) a
March 10, 2009 at 3:57 am
I think the problem is the unicode->ascii conversion that is happening somewhere along the way. C# strings are always 16-bit.
Try changing
...
March 5, 2009 at 4:19 am
Try this...
CREATE FUNCTION [dbo].[ccsc_admis_numbers3New](
@type varchar(1),
@year int,
...
March 5, 2009 at 3:26 am
Use CASE expression
SELECT CASE WHEN SKU LIKE '%EC%' THEN 'EC'
WHEN SKU LIKE '%DD%' THEN 'DD'
...
March 4, 2009 at 7:39 am
You need a way to fully define your ordering to give you a "first".
See if either of these help
with cte as (
select entry_id,group_id,cost,
row_number()...
March 3, 2009 at 9:56 am
Viewing 15 posts - 1,186 through 1,200 (of 1,439 total)