Zwei Wenn Auswahl, während eine Auswahlabfrage
-
10-07-2019 - |
Frage
SELECT o.id, o.id als oid, o.id als orderId, o.cid, o.date, o.state, o.price, o.currency, o.lastChange, o.url AS permalink, o.period, o.bloggerId, o.bloggerShare, o.offerValidity, o.rebate, o.cid, o.reason, o.bidReason, o.bidDate, o.bidPeriod, o.rate, o.lastChange2, o.permalinkDate, o.cancelDate, o.bidValidDate, o.acceptDate, o.approveDate, o.archived, o.bloggerPrice, o.customerPrice, o.cancelReason, o.listPrice, o.adFormat, o.lastPayDate, o.startDate, o.endDate, o.customerBidDate, o.zoneId, c.campaignStartDate, c.campaignEndDate, c.type als Kampagnentyp, c.test, c.test1, c.special, c.packageId, c.fixPrice, c.type, c.priceBidding, c.textCreation, o.hiddenField, o.startDate, p.url als producturlold, p.pressurl, p.companyurl, p.blogurl, p.mediaurl, p.short, T.BESCHREIBUNG als product, p.description2, p.image, c.teaser, c.kind, c.title, mc.country als campaignCountry, c.minlen, c.productPrice, c.currency als campaignCurrency, c.productTitle, c.url, c.producturl, c.pressurl, c.companyurl, c.blogurl, c.mediaurl, c.description, c.image, c.teaser, c.productReturn, c.testProduct, c.mid als customerId, c.adText, c.fixAdText, c.requiresBlog, c.bidStop, c.accountingPeriod, c.actionCodeType, c.actionCodesDescription, ac.code, ac2.code als Masscode, b.title als Blogtitle, b.url als bloggerurl, b.pis als pi, b.uniqueVisitors als UVS, b.pisCounter als pisCounter, b.uvsCounter als uvsCounter, b.aPI als aPI, b.aUV als AUV, b.id als blogid, p.title als productTitleOld, b.lastChange als blogLastChange, b.trRank, r1.rate als orderRate, r2.Rate als memberRate, b.reviews FROM Raten r1, r2 Raten, Aufträge o links Blog b auf (o.blogId = b.id) beitreten links Codes ac auf (ac.orderId = o.id), Kampagne c beitreten links Produkt p auf (c.productId = p.id) beitreten LEFT JOIN AC2-Codes auf (ac2.campaignId = c.id und c.actionCodeType = 2), Person mc wo o.cid = c.id und mc.mid = c.mid und o.id = '223704' und o.state <> 0 und r1.currency = o.currency und r2.currency = 'EUR' und r1.date = FROM_UNIXTIME (o.date, '% Y-% m-% d') und r2.date = r1.date
I wnat zu testen, ob memberRate und orderRate Null ist es sollte auch weiterhin, wie kann ich das tun? Jede Idee?
Lösung
Tack diese am Ende sollte es tun:
--Within the WHERE clause
AND r2.Rate IS NOT NULL
AND r1.Rate IS NOT NULL
Andere Tipps
Ich bin mir nicht sicher, ob ich verstehe, was Sie fordern, aber and memberRate is not null and orderRate is not null
bis zum Ende Ihrer Abfrage hinzufügen, und Sie werden alle Ergebnisse überspringen, wo eine dieser beiden Felder sind null.