[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Dato håndtering i SQL



Hvis nu man satte sig ned, og så analytisk på det.
Og det gjorde jeg så...

where (opgavestart between " + (start) + " and " + (snyde)  or
opgaveslut between " + (start) + " and " + (stop) or
(start) + " between opgavestart and opgaveslut  or
(slut) + " between opgavestart and opgaveslut)

Så hvis man lige tænker sig om først...

/DAN

----- Original Message ----- 
From: "Ole Kofoed Hansen" <sslug@sslug>
To: <sslug@sslug>
Sent: Thursday, March 18, 2004 10:54 PM
Subject: Re: [PROGRAMMERING] Dato håndtering i SQL


> Dan Mortensen wrote:
> > Hejsa
> >
> > Jeg har lige stirret mig blind på det her.
> >
> > Jeg har et projekt med noget fotograf booking, hvor man ikke skal kunne
booke to opgaver inden for samme tids interval.
> >
> > Der er flg væsentlige felter
> > id int autoinc
> > opgavenavn tinytext
> > opgavestart timestamp
> > opgaveslut timestamp
> >
> > Så i min kontrolrutine laver jeg et check på om man kan indsætte
> >
> > select id, opgavenavn, opgavestart, opgaveslut from fotografbestilling
where (opgavestart between '2004/03/18 12:00' and '2004/03/18 12:30' or
opgaveslut between '2004/03/18 12:00' and '2004/03/18 12:30')
> >
> > Det virker sådan set OK, men problemet er jo når der kommer en opgave
som falder helt uden for disse opgavestart og slut tidspunkter.
> >
> > Fx har jeg en test hvor opgavestart er kl 10:30 og varer til 13:00, den
bliver ikke fanget af denne rutine.
> >       id opgavenavn left(time_format(opgavestart,'%T'),5)
left(time_format(opgaveslut,'%T'),5)
> >       631 byportræt 10:30 13:00
>
> Prøv at tilføje:
> or '2004/03/18 12:00' between opgavestart and opgaveslut
>
> Det burde kunne klare det.
>
> Med venlig hilsen
>
> Ole



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *