Click here to Skip to main content
15,908,173 members
Home / Discussions / Database
   

Database

 
AnswerRe: want a school good database ( tables and columns) Pin
Wendelius27-Mar-11 2:31
mentorWendelius27-Mar-11 2:31 
GeneralRe: want a school good database ( tables and columns) Pin
my name is coder ! ! !27-Mar-11 9:07
my name is coder ! ! !27-Mar-11 9:07 
GeneralRe: want a school good database ( tables and columns) Pin
Wendelius27-Mar-11 9:17
mentorWendelius27-Mar-11 9:17 
GeneralRe: want a school good database ( tables and columns) Pin
my name is coder ! ! !27-Mar-11 21:29
my name is coder ! ! !27-Mar-11 21:29 
GeneralRe: want a school good database ( tables and columns) Pin
Klaus-Werner Konrad31-Mar-11 8:29
Klaus-Werner Konrad31-Mar-11 8:29 
AnswerRe: want a school good database ( tables and columns) Pin
Eddy Vluggen28-Mar-11 9:00
professionalEddy Vluggen28-Mar-11 9:00 
QuestionDelta between records in one column Pin
Member 377323026-Mar-11 20:44
Member 377323026-Mar-11 20:44 
AnswerRe: Delta between records in one column Pin
Wendelius26-Mar-11 22:07
mentorWendelius26-Mar-11 22:07 
If you use a subquery to fetch the previous (or next) record you must ensure that only 1 record is fetched. So this means that you have to be able to order the rows based on some column and take only the first, for example using TOP 1. So your query could look something like:
SQL
SELECT ...
       DATEDIFF(seconds,
                datecolumn1, 
                (SELECT TOP 1 datecolumn2 
                 FROM YourTable a1
                 WHERE ...
                 ORDER BY datecolumn2 DESC))
FROM YourTable
WHERE ...

The need to optimize rises from a bad design.My articles[^]

GeneralRe: Delta between records in one column Pin
Member 377323026-Mar-11 22:24
Member 377323026-Mar-11 22:24 
GeneralRe: Delta between records in one column Pin
Wendelius26-Mar-11 22:42
mentorWendelius26-Mar-11 22:42 
GeneralRe: Delta between records in one column Pin
Member 377323026-Mar-11 23:16
Member 377323026-Mar-11 23:16 
GeneralRe: Delta between records in one column Pin
Wendelius26-Mar-11 23:38
mentorWendelius26-Mar-11 23:38 
AnswerRe: Delta between records in one column Pin
Jörgen Andersson27-Mar-11 8:26
professionalJörgen Andersson27-Mar-11 8:26 
GeneralRe: Delta between records in one column [modified] Pin
Member 377323027-Mar-11 22:34
Member 377323027-Mar-11 22:34 
QuestionPivot? Pin
Andy_L_J26-Mar-11 14:56
Andy_L_J26-Mar-11 14:56 
AnswerRe: Pivot? Pin
Mycroft Holmes26-Mar-11 19:56
professionalMycroft Holmes26-Mar-11 19:56 
GeneralRe: Pivot? Pin
Andy_L_J27-Mar-11 18:18
Andy_L_J27-Mar-11 18:18 
GeneralRe: Pivot? Pin
Andy_L_J27-Mar-11 23:47
Andy_L_J27-Mar-11 23:47 
QuestionWhat are solutions for a way-too-big database? Pin
bobbi200426-Mar-11 7:23
bobbi200426-Mar-11 7:23 
AnswerRe: What are solutions for a way-too-big database? Pin
Wendelius26-Mar-11 7:41
mentorWendelius26-Mar-11 7:41 
GeneralRe: What are solutions for a way-too-big database? Pin
bobbi200426-Mar-11 16:20
bobbi200426-Mar-11 16:20 
AnswerRe: What are solutions for a way-too-big database? Pin
PIEBALDconsult26-Mar-11 17:21
mvePIEBALDconsult26-Mar-11 17:21 
GeneralRe: What are solutions for a way-too-big database? Pin
bobbi200427-Mar-11 6:53
bobbi200427-Mar-11 6:53 
AnswerRe: What are solutions for a way-too-big database? Pin
Klaus-Werner Konrad31-Mar-11 8:42
Klaus-Werner Konrad31-Mar-11 8:42 
QuestionMultiple selection from the same table Pin
CodingLover25-Mar-11 19:43
CodingLover25-Mar-11 19:43 

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.