Click here to Skip to main content
15,899,474 members
Home / Discussions / Database
   

Database

 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 6:17
BeerFizz31-May-06 6:17 
QuestionPls Help - Visual C++ with ADO Pin
antonaras30-May-06 5:52
antonaras30-May-06 5:52 
AnswerRe: Pls Help - Visual C++ with ADO [modified] Pin
George L. Jackson30-May-06 11:29
George L. Jackson30-May-06 11:29 
QuestionADO Books Pin
Rajkamal_dfine30-May-06 4:23
Rajkamal_dfine30-May-06 4:23 
QuestionConnection error Pin
Paps230-May-06 3:22
Paps230-May-06 3:22 
AnswerRe: Connection error Pin
Jerry Hammond30-May-06 7:18
Jerry Hammond30-May-06 7:18 
QuestionTrap difference between two records... Pin
deep730-May-06 2:31
deep730-May-06 2:31 
AnswerRe: Trap difference between two records... Pin
Colin Angus Mackay30-May-06 2:47
Colin Angus Mackay30-May-06 2:47 
deep7 wrote:
i can't get how to do this..could any one plz help me out here


What aspect? The getting the rows out of the database? The looping over the columns? What? Since you asked in the SQL forum, I'm gussing that it is the getting stuff out of the database aspect.

To get the two rows in one result set use this:
SELECT TOP 2 * 
FROM MyTable 
ORDER BY [date] DESC


To get two result sets each with one row use this:
SELECT TOP 1 * 
FROM MyTable 
ORDER BY [date] DESC;
 
SELECT TOP 1 * 
FROM MyTable 
WHERE [date] NOT IN(SELECT MAX([date]) FROM MyTable)
ORDER BY [date] DESC;


Does this help?


"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)

My: Website | Blog
GeneralRe: Trap difference between two records... Pin
deep730-May-06 18:15
deep730-May-06 18:15 
GeneralRe: Trap difference between two records... Pin
r.stropek4-Jun-06 6:35
r.stropek4-Jun-06 6:35 
QuestionHow to convert the Sql tables to stored procedure Pin
a_n_sowmya30-May-06 0:31
a_n_sowmya30-May-06 0:31 
AnswerRe: How to convert the Sql tables to stored procedure Pin
Colin Angus Mackay30-May-06 2:12
Colin Angus Mackay30-May-06 2:12 
AnswerRe: How to convert the Sql tables to stored procedure Pin
sathish s31-May-06 2:06
sathish s31-May-06 2:06 
GeneralRe: How to convert the Sql tables to stored procedure Pin
a_n_sowmya31-May-06 5:46
a_n_sowmya31-May-06 5:46 
GeneralRe: How to convert the Sql tables to stored procedure Pin
sathish s31-May-06 19:02
sathish s31-May-06 19:02 
GeneralRe: How to convert the Sql tables to stored procedure Pin
a_n_sowmya31-May-06 19:31
a_n_sowmya31-May-06 19:31 
Questionhow to apply where condition on date field in msaccess Pin
GANsJob29-May-06 22:02
GANsJob29-May-06 22:02 
AnswerRe: how to apply where condition on date field in msaccess Pin
Michael Potter30-May-06 8:46
Michael Potter30-May-06 8:46 
GeneralRe: how to apply where condition on date field in msaccess Pin
GANsJob1-Jun-06 3:55
GANsJob1-Jun-06 3:55 
QuestionJust Time in DateTime Field Pin
Ali Beirami29-May-06 9:00
Ali Beirami29-May-06 9:00 
AnswerRe: Just Time in DateTime Field Pin
Michael Potter30-May-06 8:48
Michael Potter30-May-06 8:48 
QuestionRe: Just Time in DateTime Field Pin
Ali Beirami30-May-06 12:51
Ali Beirami30-May-06 12:51 
AnswerRe: Just Time in DateTime Field Pin
Michael Potter31-May-06 3:07
Michael Potter31-May-06 3:07 
QuestionSELECT QUERY Pin
NICE TO MEET29-May-06 0:31
NICE TO MEET29-May-06 0:31 
AnswerRe: SELECT QUERY Pin
Colin Angus Mackay29-May-06 4:59
Colin Angus Mackay29-May-06 4:59 

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.