Viewing 15 posts - 271 through 285 (of 321 total)
A little more better...
DECLARE @MyTable TABLE
(
myVersion VARCHAR(10),
LastDateA DATETIME,
LastDateB DATETIME,
LastDateC DATETIME
)
INSERT @MyTable VALUES ('VERSION A', '01/01/2004', '02/01/2004', '01/03/2004')
INSERT @MyTable VALUES ('VERSION A', '03/01/2004', '02/04/2004', '01/09/2004')
INSERT @MyTable VALUES ('VERSION A', '04/01/2004', '04/09/2004',...
June 14, 2005 at 3:02 pm
This will work for ANY No of duplicates and will keep the first row with the MIN(ID)
SET NOCOUNT ON
DECLARE @theatre TABLE
(
[ID] INT IDENTITY,
LastName VARCHAR(25),
FirstName VARCHAR(25)
)
INSERT INTO @theatre (LastName, FirstName) VALUES...
June 14, 2005 at 2:33 pm
You get Null because you select NULL : )
Null As 'HireCnt'
Null As 'ApplicantCnt'
About the numbers they might be correct. It seems that 1 row gives...
June 14, 2005 at 2:05 pm
For someone to be able to help you should provide the tables and sample data with the req result.
From my undertanding (which can be wrong ) if you transform your...
June 13, 2005 at 2:21 pm
AS
FROM Client
FROM Nurse
June 10, 2005 at 8:31 am
SELECT AAA.OD_ID,Op_Sec_ID,Op_Val_Date,Sec_Date,Sec_Price
FROM
#tblOP AAA INNER JOIN
(SELECT OD_ID,MIN(MyNmb) MyDiff
FROM
(SELECT A.Od_Id,A.Op_Sec_Id,A.Op_Val_Date,B.Sec_ID,B.Sec_Date,B.Sec_Price, CASE WHEN A.Op_Val_Date>B.Sec_Date THEN CAST(A.Op_Val_Date as int)-CAST(B.Sec_Date as int) ELSE CAST(B.Sec_Date as int)-CAST(A.Op_Val_Date as int) END MyNmb
FROM #tblOP A inner join #tblSecurity...
June 9, 2005 at 3:13 pm
Won't work to have 4 derived tables.
The solution is based on comb of two diff sets.
so if C,N,Y,O form 2 sets the sol will work
ex: C,N can be combined...
June 9, 2005 at 10:28 am
The catch is to label the rows for each DATA and ID2 with Ordered Numbers and match the rows with diff ID2 but the same Data and RowNumber
June 8, 2005 at 2:25 pm
Hmm
what if you change the design of the table
StartPeriod---DateTime
EndPeriod ---DateTime
Status ----Available/NotAvailable
and when you insert a new row upgrade EndPeriod check the status on last row and if different add...
June 8, 2005 at 2:02 pm
SET NOCOUNT ON
DECLARE @T Table (ID int, ID2 char(1) , Data varchar(10))
insert into @T (ID,ID2,Data) Values(1,'N','Data')
insert into @T (ID,ID2,Data) Values(2,'N','Data' )
insert into @T (ID,ID2,Data) Values(3,'C','Data' )
insert into @T (ID,ID2,Data) Values(4,'C','Data5'...
June 8, 2005 at 1:38 pm
UPS ya I was missing 20 and 30 ... didn't notice (Thks Remi : ) )
for the (10,a) pair I SAID the sol is not working... he needs to check...
June 8, 2005 at 10:14 am
At least (ID,Country) has to be key for the Solution to work.
Otherwise one more step need to be added to treat this rows depending on FirstName...
set nocount on
create table #t(IdRow...
June 8, 2005 at 9:22 am
If you have a KEY on your table you can achieve what you want otherwise it won't work (like here where IdRow is not a Key...).
set nocount on
create table...
June 8, 2005 at 7:15 am
SET QUOTED_IDENTIFIER OFF
SET NOCOUNT ON
DECLARE @SumOfMaximums FLOAT, @DataValue FLOAT, @PreviousDataValue FLOAT, @SeqNo INT,@Tid INT, @MaximumValue FLOAT
SET @Tid=11
CREATE TABLE [#TRENDDATA] ( [SEQUENCENUMBER_] [int] NOT NULL ,
[TID_] [int] NOT NULL ,
[DATE_STAMP_]...
June 2, 2005 at 12:50 pm
SELECT CASE WHEN Step1 IS NULL THEN 0 ELSE 1 END
This will return the row as integer.
In your case it shows 1/1/1900 because it transforms that integer 0...
June 2, 2005 at 11:32 am
Viewing 15 posts - 271 through 285 (of 321 total)