Viewing 15 posts - 526 through 540 (of 1,082 total)
Try this:
DECLARE @tmp TABLE
(id INT IDENTITY(1,1)
,fechahora DATETIME
,m3salida DECIMAL(15,8))
INSERT INTO @tmp
(fechahora,m3salida)
SELECT '2008-11-17',569512.00 UNION all
SELECT '2008-11-17',966786.00 UNION all
SELECT '2008-11-17',465119.00
SELECT
[1].ID
,[1].fechahora
,[1].m3salida
,[2].m3salida
,[1].m3salida- isnull([2].m3salida,0)
FROM @tmp [1]
LEFT JOIN @tmp [2]
ON [1].id...
November 20, 2008 at 9:41 am
Max this op is using SQL 2000 ROW_NUMBER() won't work
November 20, 2008 at 9:34 am
cool,
Could you post your solution once you find the correct answer or if you need more help let us know.
thanks
Chris
November 20, 2008 at 7:59 am
Thanks longobardia,
I think he found it 2 posts back. I'm trying to get into the habit of helping people who are new to SQL with finding the problems/solutions themselves with...
November 20, 2008 at 7:59 am
Did this work?
November 20, 2008 at 2:30 am
are you saying that the primary key on your table is a nvarchar?
November 19, 2008 at 10:27 am
this is the first time I've used this table bu maybe something like this:
SELECT DISTINCT
p.Name,
c.Name
FROM sysdepends d
INNER JOIN sys.Objects p ON p.Object_ID = d.Id
INNER JOIN sys.Objects c ON c.Object_ID...
November 19, 2008 at 10:24 am
Here is some code.
But this will run like a dog if it's run on all tables/comments
DECLARE @tbltables TABLE
([Name] VARCHAR(10))
INSERT INTO @tbltables
SELECT 'Table_A' UNION
SELECT 'Table_B'
DECLARE @Comments TABLE
(Id INT,
[text] VARCHAR(MAX))
INSERT INTO @Comments...
November 19, 2008 at 10:21 am
IS this working with the change to the insert statement yet?
November 19, 2008 at 6:19 am
Thanks Jeff,
Like Jeff has just shown you , it's good to out put you order by so you can see the values.
The reason you still need to order by the...
November 19, 2008 at 2:19 am
yes but you need to alias in the select part of the query as well otherwise sql doesn't know which table that columns is coming from...
November 18, 2008 at 10:27 am
so in your example, if the null values get given 5 and the non-nulls get 4 then that shows
4 comes before 5
so non-nulls come before nulls.
does that make sense.
I...
November 18, 2008 at 10:26 am
Ok I think you need to realise that it's not sorting but
column 0 or column 1
It's sorting by the numbers 0 and 1 which means 0 always comes before 1.
November 18, 2008 at 10:24 am
I think you need to a filter on the last table in the nested.
November 18, 2008 at 10:22 am
Viewing 15 posts - 526 through 540 (of 1,082 total)