我在加入以下陈述时遇到了一些困难。
Select *
From yr_property
Left Join yr_lease on yr_lease.propertynum = yr_property.propertynum
Where yr_lease.leasenum is null;
Select Dateto
From yr_advert;
我已经尝试加入表格,但我认为并非一切都正确
left join yr_advert on yr_advert.propertynum = yr_property.propertynum
我的目标是...
列出未出租的物业,并注明其最后一次发布广告的日期(最后一次广告停止的日期)。
使用中的表
yr_property
Propertynum , CHAR(5), NOT nullable (PRIMARY KEY 1)
Street , VARCHAR(25), nullable
Area , VARCHAR2(15), nullable
City , VARCHAR2(15), nullable
Postcode , VARCHAR2(8), nullable
Prop_type , VARCHAR2(15), nullable
Rooms NUMBER , (2,0), nullable
Staffnum , CHAR(5), nullable
Branchnum , CHAR(3) nullable
Ownernum , CHAR(5) nullable
Comments , VARCHAR2(500) nullable
Date_ended , DATE nullable **FORMAT EG - 11/JAN/2004**
年租约
Leasenum , CHAR(5), NOT nullable (PRIMARY KEY 1)
Renternum, , CHAR(5), nullable
Propertynum , CHAR(5), nullable (FOREIGN KEY)
Paymentmethod , VARCHAR2(15),nullable
Rent , NUMBER(17,2), nullable
Depositamount , NUMBER(15), nullable
Depositpaid , VARCHAR2(5), nullable
Rentstart , DATE nullable
Rentfinish , DATE nullable **FORMAT EG - 11/JAN/2004**
yr_advert
ADVERTNUM , CHAR(10), NOT nullable (PRIMARY KEY 1)
PROPERTYNUM , CHAR(5), NOT nullable (PRIMARY KEY 2)
STAFFNUM , CHAR(5), nullable
TOAPPEAR , VARCHAR2(100), nullable
DATEFROM , DATE, nullable
DATETO , DATE , nullable **FORMAT EG - 11/JAN/2004**
WORDS, VARCHAR2(500), nullable
感谢您为我提供的任何帮助。