[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] SQL: mange unions ?



Martin Møller Skarbiniks Pedersen skrev:
> Hejsa,
>  Jeg har en table med en foreign key 'customer' og fem dato felter.
>  Jeg har brug for at finde alle forskellige datoer for en bestemt
> 'customer' over de fem
> dato felter.
> 
>  Kan flg. skrives bedre, hurtigere, smartere ?
> 
> 
> SELECT post_1_date FROM tickets t, customers c WHERE
>  t.customer=c.id
> AND
> c.name='$customer'
> AND
>  post_1_date>=to_date('$start','YYYY-MM-DD')
> AND
>  post_1_date<=to_date('$end','YYYY-MM-DD')
> 
> UNION
> 
> SELECT post_2_date FROM tickets t, customers c WHERE
>  t.customer=c.id
> AND
> c.name='$customer'
> AND
>  post_2_date>=to_date('$start','YYYY-MM-DD')
> AND
>  post_2_date<=to_date('$end','YYYY-MM-DD')
> 
>osv.
Det ser ud som om din tabel har fem forskellige datoer pr. post. Er det
rigtigt?


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-08-01, 02:01 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] *