Hi all i am having trouble understanding the a FIFO concept.
i have pusedo waiting list for a houses on a waiting list table, more than two potential tenants can bid for a property what i would like to do is filter the data by a fifo style query based on the start date. i would like some guidance on how to perform this.
CREATE TABLE Waiting_list(
Waiting# SMALLINT IDENTITY(0001,1) not null,
Customer# BIGINT ,
Property# SMALLINT not null,
Tenant# BIGINT,
Waiting_Start_date SMALLDATETIME,
Waiting_Property_type CHAR(10),
Rent_offer SMALLMONEY,
CONSTRAINT WAITING_LIST_PK PRIMARY KEY (Waiting#),
CONSTRAINT WAITING_PROPERTIES_FK FOREIGN KEY (Property#)REFERENCES Properties(Property#),
CONSTRAINT WAITING_TENANT_FK FOREIGN KEY (Tenant#)REFERENCES Tenant(Tenant#),
CONSTRAINT WAITING_CUSTOMER_FK FOREIGN KEY (Customer#)REFERENCES Customer(Customer#)
);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200000,15,'House','2008-10-21',150);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200005,2,'Town House','2008-11-1',130);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200010,2,'Unit','2008-10-15',190);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200015,20,'Villa','2008-12-20',200);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200020,18,'House','2008-09-1',200);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200025,19,'Unit','2008-11-01',250);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200030,20,'Unit','2008-09-17',190);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200035,18,'House','2008-12-12',230);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200040,11,'Villa','2008-11-23',210);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200045,16,'House','2008-09-30',250);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200050,22,'Unit','2009-1-1',200);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200055,8,'Villa','2008-11-1',170);
INSERT INTO Waiting_list (Customer#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(200060,20,'Unit','2008-10-12',185);
INSERT INTO Waiting_list (Tenant#,Property#,Waiting_Property_type,Waiting_Start_date, Rent_offer)
VALUES(100018,5,'Town House','2008-11-2',190);
EDITed ... for code tags