Click here to Skip to main content
15,888,527 members
Home / Discussions / Database
   

Database

 
AnswerRe: problem with conversion of a char data type to a datetime data type Pin
Mycroft Holmes13-Jan-10 18:24
professionalMycroft Holmes13-Jan-10 18:24 
GeneralRe: problem with conversion of a char data type to a datetime data type Pin
Payal_e_m14-Jan-10 14:38
Payal_e_m14-Jan-10 14:38 
QuestionNeed help with what seems to be an easy SQL query.... Pin
James Shao13-Jan-10 4:18
James Shao13-Jan-10 4:18 
AnswerRe: Need help with what seems to be an easy SQL query.... [modified] Pin
Luc Pattyn13-Jan-10 4:40
sitebuilderLuc Pattyn13-Jan-10 4:40 
AnswerRe: Need help with what seems to be an easy SQL query.... Pin
loyal ginger13-Jan-10 5:36
loyal ginger13-Jan-10 5:36 
AnswerRe: Need help with what seems to be an easy SQL query.... Pin
i.j.russell13-Jan-10 8:59
i.j.russell13-Jan-10 8:59 
GeneralRe: Need help with what seems to be an easy SQL query.... Pin
James Shao17-Jan-10 2:50
James Shao17-Jan-10 2:50 
AnswerRe: Need help with what seems to be an easy SQL query.... Pin
Lee Ludden13-Jan-10 13:33
Lee Ludden13-Jan-10 13:33 
CREATE TABLE #Tracker(
[Id] [int] NOT NULL,
[Ticker] [nvarchar](4) NOT NULL,
[SlopeOfLine] [int] NOT NULL,
)
GO

INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (1, 'MSFT', 5)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (2, 'MSFT', 2)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (3, 'MSFT', 1)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (4, 'MSFT', 0)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (5, 'MSFT', -3)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (6, 'MSFT', 1)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (1, 'DELL', -2)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (2, 'DELL', -1)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (3, 'DELL', 2)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (4, 'DELL', 4)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (5, 'DELL', 3)
INSERT INTO #Tracker (Id, Ticker, SlopeOfLIne) VALUES (6, 'DELL', 4)
GO

SELECT T1.Id, T1.Ticker, T1.SlopeOfLIne
FROM #Tracker t1
LEFT OUTER JOIN (SELECT * FROM #Tracker WHERE SlopeOfLine<0) T2 ON
T2.Ticker = t1.Ticker
AND T2.Id > t1.Id
WHERE T2.Id IS NULL
AND t1.SlopeOfLine < 0

GO

This may or may not be faster than the subquery method used above.
GeneralRe: Need help with what seems to be an easy SQL query.... Pin
James Shao17-Jan-10 2:49
James Shao17-Jan-10 2:49 
AnswerRe: Need help with what seems to be an easy SQL query.... Pin
James Shao13-Jan-10 13:57
James Shao13-Jan-10 13:57 
AnswerRe: Need help with what seems to be an easy SQL query.... Pin
Niladri_Biswas14-Jan-10 16:27
Niladri_Biswas14-Jan-10 16:27 
Questionavg (sqlite) Pin
jashimu13-Jan-10 3:39
jashimu13-Jan-10 3:39 
AnswerRe: avg (sqlite) Pin
James Shao13-Jan-10 4:36
James Shao13-Jan-10 4:36 
GeneralRe: avg (sqlite) [modified] Pin
jashimu13-Jan-10 5:00
jashimu13-Jan-10 5:00 
AnswerRe: avg (sqlite) Pin
loyal ginger13-Jan-10 5:44
loyal ginger13-Jan-10 5:44 
AnswerRe: avg (sqlite) Pin
Niladri_Biswas14-Jan-10 16:49
Niladri_Biswas14-Jan-10 16:49 
QuestionMS SQL Server 2005 UDF only returns first character from a string value Pin
Steven J Jowett13-Jan-10 1:40
Steven J Jowett13-Jan-10 1:40 
AnswerRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
Covean13-Jan-10 1:44
Covean13-Jan-10 1:44 
AnswerRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
J4amieC13-Jan-10 2:17
J4amieC13-Jan-10 2:17 
GeneralRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
Steven J Jowett13-Jan-10 4:25
Steven J Jowett13-Jan-10 4:25 
GeneralRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
Ashfield13-Jan-10 5:15
Ashfield13-Jan-10 5:15 
GeneralRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
Steven J Jowett13-Jan-10 5:21
Steven J Jowett13-Jan-10 5:21 
GeneralRe: MS SQL Server 2005 UDF only returns first character from a string value Pin
Ashfield13-Jan-10 8:36
Ashfield13-Jan-10 8:36 
Questionupdate Query with Order by Clause- SQL Server2008 Pin
Paramu197311-Jan-10 22:51
Paramu197311-Jan-10 22:51 
AnswerRe: update Query with Order by Clause- SQL Server2008 Pin
Mycroft Holmes11-Jan-10 23:21
professionalMycroft Holmes11-Jan-10 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.