[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
 

[SQL] tid, nyeste



Hej,
Jeg har flg. MySQL-tabel:

+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      |      | PRI | NULL    | auto_increment |
| arrival     | timestamp(8) | YES  |     | NULL    |                |
| departure   | timestamp(8) | YES  |     | NULL    |                |
| room_number | int(11)      | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+

Forestil dig, at der er en hoteldatabase, med reservering og historik. Der 
kan altså være mange records, som indeholder samme room_number. Hvordan ser 
jeg hvilke værelser, der er ledige fra en given startdato og uendelig mange 
dage frem?

Med følgende får jeg alle de værelser med, som på et tidspunkt har været 
beboet af nogen som er flyttet igen: 

select room_number from tblrooms where to_days(departure) < to_days
(startdato)

Mvh,
Christian Nielsen  


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 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] *