-4

誰かがこのクエリを書き直すのを手伝ってくれませんか? クエリを記述してこの結果を達成できるのか、それともプロシージャを記述しなければならないのかはわかりません。

このクエリの結果は、2 つの別々の列 wherelm.listingmanagerid=bd.renteridlm.listingmanagerid<>bd.renteridin 別の列に必要です。私を助けてください。

選択セクションに両方の列が必要です (lm.listingmanagerid=bd.renterid と lm.listingmanagerid<>bd.renterid)

以下のクエリを使用すると、listingmanagerID が bookingdetails テーブルと一致する結果が得られます。異なる列の両方のテーブルから一致しない ID を取得できますか select bd.listingid from bookingdetails bd, listingmanager lm where lm.listingmanagerid=bd.renterid

両方のテーブルの構造の下

CREATE TABLE BOOKINGDETAILS ( BOOKINGDETAILSID VARCHAR2(28) NOT NULL, LISTINGID VARCHAR2(28) NOT NULL, TRAVELLERPROTECTIONID VARCHAR2(28), TRAVELLERID VARCHAR2(28) NOT NULL, TRAVELLERNAME VARCHAR2(50) NOT NULL, CHECKINDATE DATE NOT NULL, CHECKOUTDATE DATE NOT NULL, NOOFGUEST NUMBER NOT NULL, TERMSANDCON LONG RAW, BOOKINGSTATUS NUMBER DEFAULT 0 NOT NULL, BOOKINGDATE DATE NOT NULL, UPDATEDATE DATE, UPDATEDBY VARCHAR2(50) NOT NULL, CURRENCYCODE VARCHAR2(10), BOOKINGAMOUNT FLOAT, AOVSERVICEFEE FLOAT, AMENITYWITHFEE VARCHAR2(3000), OCA NUMBER NOT NULL, RENTALTOTALAMOUNT FLOAT, AMENITIESFEE FLOAT, RENTERID VARCHAR2(28), CANCELLATIONAMOUNT FLOAT, PAYMENTID VARCHAR2(28), CCNUMBER VARCHAR2(30), LISTINGMANAGERID VARCHAR2(28), OWNERVIEWSTATUS NUMBER(2) DEFAULT 0, OWNERVIEWSTATUSDATE DATE, BOOKINGSTATUSDATE DATE, OWNERPAYOUTSTATUS NUMBER(2) DEFAULT 0, OWNERPAYOUTSTATUSDATE DATE, DISPUTESTATUS NUMBER(2) DEFAULT 0, DISPUTESTATUSDATE DATE, TRAVELLERPAYMENTSTATUS NUMBER(2) DEFAULT 0, TRAVELLERPAYMENTSTATUSDATE DATE, REJECTIONREASON NUMBER(10), REJECTIONREASONDETAIL VARCHAR2(200), CONSTRAINT SYS_C004345 PRIMARY KEY ( BOOKINGDETAILSID ) );

CREATE TABLE LISTINGMANAGER ( LISTINGMANAGERID VARCHAR2(28) NOT NULL, FIRSTNAME VARCHAR2(30) NOT NULL, LASTNAME VARCHAR2(30) NOT NULL, PRIMARYPHONE VARCHAR2(20) NOT NULL, ALTERNATEPHONE VARCHAR2(20), EMAIL VARCHAR2(100) NOT NULL, USERNAME VARCHAR2(100) NOT NULL, PASSWORD VARCHAR2(32) NOT NULL, RECALLGUID VARCHAR2(32), CUSTOMERSINCE DATE, LASTUPDATED DATE NOT NULL, UPDATEDBY VARCHAR2(28) NOT NULL, OCA NUMBER NOT NULL, PWCHANGEREQUIRED VARCHAR2(1), PWEXPIREDATE DATE, LASTLOGIN DATE, CALLINGHOURS VARCHAR2(200), TIMEZONEID VARCHAR2(20), CREATEDATE DATE, CREATEIPADDRESS VARCHAR2(16), AUTORENEWFLAG VARCHAR2(1), AUTORENEWREMOVEDDATE DATE, AUTORENEWDATE DATE, ISSUPPLIER VARCHAR2(1) DEFAULT 'N', PREFFEREDLANGUAGE VARCHAR2(2), LOCALEID VARCHAR2(2), ADDRESS1 VARCHAR2(50), ADDRESS2 VARCHAR2(50), CITYID VARCHAR2(28), COUNTRYID VARCHAR2(28), STATEPROVINCEID VARCHAR2(28), POSTALCODE VARCHAR2(10), REGISTRATIONSOURCE VARCHAR2(1), PPCTYPEID VARCHAR2(28), ABOUTME VARCHAR2(2000), PICTUREFILEPATH VARCHAR2(200), ISPROFILEPICTUREDISPLAY VARCHAR2(1), GHOSTUSER VARCHAR2(1) DEFAULT 'N', PROFILEID VARCHAR2(10), CONSTRAINT SYS_C005739 PRIMARY KEY ( LISTINGMANAGERID ) , CONSTRAINT USERNAME_CONSTRAINT UNIQUE(USERNAME) );

ありがとう

4

1 に答える 1