views:

63

answers:

2

Hello I have this query :

SELECT o.id, o.id as oid, o.id as 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 as campaignType, c.test, c.test1, c.special, c.packageId,
       c.fixPrice, c.type, c.priceBidding, c.textCreation, o.hiddenField,
       o.startDate, p.url as producturlold, p.pressurl, p.companyurl,
       p.blogurl, p.mediaurl, p.short,
       p.description as productDescription, p.description2, p.image,
       c.teaser, c.kind, c.title, mc.country as campaignCountry,
       c.minlen, c.productPrice, c.currency as 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 as customerId, c.adText,
       c.fixAdText, c.requiresBlog, c.bidStop, c.accountingPeriod,
       c.actionCodeType, c.actionCodesDescription, ac.code,
       ac2.code as massCode, b.title as blogtitle, b.url as bloggerurl,
       b.pis as pis, b.uniqueVisitors as uvs, b.pisCounter as pisCounter,
       b.uvsCounter as uvsCounter, b.aPI as aPI, b.aUV as aUV,
       b.id as blogId, p.title as productTitleOld,
       b.lastChange as blogLastChange, b.trRank, r1.rate as orderRate,
       r2.Rate as memberRate, b.reviews
FROM   rates r1, rates r2, orders o
left   join blog b on (o.blogId = b.id)
left   join codes ac on (ac.orderId = o.id), campaign c
left   join product p on (c.productId = p.id)
left   join codes ac2 on (ac2.campaignId = c.id and
                         c.actionCodeType = 2),
 person mc
where  o.cid = c.id
and    mc.mid = c.mid
and    o.id = '223704'
and    o.state <> 0
and    r1.currency = o.currency
and    r2.currency = 'EUR'
and    r1.date = FROM_UNIXTIME(o.date, '%Y-%m-%d')
and    r2.date = r1.date

I wnat to test if memberRate and orderRate is Null it should continue how can i do that? Any idea?

A: 

I'm not sure I understand what you are asking, but add and memberRate is not null and orderRate is not null to the end of your query and you will skip all results where either of those two fields are null.

Keith Randall
A: 

Tack this on the end should do the trick:

--Within the WHERE clause  
AND r2.Rate IS NOT NULL 
AND r1.Rate IS NOT NULL
Josh Smeaton
Thanks this worked for me have a nice day :-)
streetparade