Click here to Skip to main content
15,895,084 members
Home / Discussions / Database
   

Database

 
GeneralDataGrid Columns Pin
numbrel16-Feb-05 5:40
numbrel16-Feb-05 5:40 
GeneralRe: DataGrid Columns Pin
Just Greeky Creek16-Feb-05 21:15
Just Greeky Creek16-Feb-05 21:15 
GeneralRe: DataGrid Columns Pin
numbrel17-Feb-05 3:06
numbrel17-Feb-05 3:06 
GeneralSQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 3:07
Richard Parsons16-Feb-05 3:07 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
Michael Potter16-Feb-05 3:24
Michael Potter16-Feb-05 3:24 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 6:50
Richard Parsons16-Feb-05 6:50 
GeneralTest data script Pin
Richard Parsons16-Feb-05 6:51
Richard Parsons16-Feb-05 6:51 
GeneralEDIT: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 7:27
Richard Parsons16-Feb-05 7:27 
The task changed. I don't care if the last record is 'f' anymore. I now only care if the second to last record is 'c'.

Why the change? Because as I started working on this problem I came to the conclusion that all the items in table1 will always have a last record of 'f'.

--Here is what I have so far.
--If you test against the test data it almost works.
--My only issue now is that I'm seeing 500 which is wrong
--because there are only 2 records not 3.
--See I'm trying Smile | :)
select * from table1
where refid in
(
select top 1 refid from
( select top 3 * from table2 where refid = table1.refid order by dt desc
) as tt where tt.code = 'c' order by dt
)


Thanks go out to Michael Potter who reminded me about correlated subqueries.
-Richard
GeneralRe: EDIT: SQL Guru challenge :) Or just a simple query question Pin
Michael Potter16-Feb-05 8:49
Michael Potter16-Feb-05 8:49 
GeneralRe: EDIT: SQL Guru challenge :) Or just a simple query question Pin
Richard Parsons16-Feb-05 11:34
Richard Parsons16-Feb-05 11:34 
GeneralRe: SQL Guru challenge :) Or just a simple query question Pin
NassosReyzidis10-Mar-05 1:11
NassosReyzidis10-Mar-05 1:11 
Generalprob in sp Pin
amalatsliit15-Feb-05 16:46
amalatsliit15-Feb-05 16:46 
GeneralRe: prob in sp Pin
Rob Graham16-Feb-05 15:59
Rob Graham16-Feb-05 15:59 
GeneralRe: prob in sp Pin
amalatsliit16-Feb-05 19:33
amalatsliit16-Feb-05 19:33 
GeneralRe: prob in sp Pin
Mike Dimmick17-Feb-05 1:31
Mike Dimmick17-Feb-05 1:31 
GeneralRe: prob in sp Pin
amalatsliit17-Feb-05 16:01
amalatsliit17-Feb-05 16:01 
GeneralCasting error when passing a strongly typed dataset from a Webservice Pin
dazzler215-Feb-05 16:41
dazzler215-Feb-05 16:41 
GeneralRe: Casting error when passing a strongly typed dataset from a Webservice Pin
dazzler215-Feb-05 20:47
dazzler215-Feb-05 20:47 
Generalprob with sp return value Pin
amalatsliit15-Feb-05 15:55
amalatsliit15-Feb-05 15:55 
GeneralRe: prob with sp return value Pin
Scott Serl16-Feb-05 8:52
Scott Serl16-Feb-05 8:52 
GeneralRe: prob with sp return value Pin
amalatsliit16-Feb-05 15:17
amalatsliit16-Feb-05 15:17 
GeneralRe: prob with sp return value Pin
Scott Serl16-Feb-05 16:25
Scott Serl16-Feb-05 16:25 
GeneralRe: prob with sp return value Pin
amalatsliit16-Feb-05 19:25
amalatsliit16-Feb-05 19:25 
QuestionCould someone answer this? Pin
Tom Wright15-Feb-05 10:51
Tom Wright15-Feb-05 10:51 
AnswerRe: Could someone answer this? Pin
Rob Graham16-Feb-05 16:11
Rob Graham16-Feb-05 16:11 

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.