mysql如果select是我的id,则不返回任何行
我有一个投标表,id,卖方id,买方id,通知金额。。。。 如果我的id sellerId存在并且不存在,我不想返回任何行 所以我的sellerId是50001,我对notifId 1260进行了投标,没有返回结果,这很好,我可以这样做,但它将返回sellerId 1442的行,并带有相同的notifId。 如果我的id存在于具有相同notifid的任何行中,我不想返回任何内容 希望那像泥浆一样清澈mysql如果select是我的id,则不返回任何行,mysql,Mysql,我有一个投标表,id,卖方id,买方id,通知金额。。。。 如果我的id sellerId存在并且不存在,我不想返回任何行 所以我的sellerId是50001,我对notifId 1260进行了投标,没有返回结果,这很好,我可以这样做,但它将返回sellerId 1442的行,并带有相同的notifId。 如果我的id存在于具有相同notifid的任何行中,我不想返回任何内容 希望那像泥浆一样清澈 SELECT n.notifId, n.senderId, n.sellerTypeId, n.
SELECT n.notifId, n.senderId, n.sellerTypeId, n.subject, ur.model, n.message, n.firstname, n.lastname, n.email, n.days, n.created_date, DATE_ADD( n.created_date, INTERVAL n.days
DAY ) AS 'dateExpires', n.requestId, ur.subCategoryId, ur.item, ur.addressStreet, ur.addressCity, ur.addressState, ur.addressZip, ur.addressAlt, ur.tvscreen, ur.tvtype, ur.tvmount, ur.dvdregion, ur.dvdusb, ur.soundtype, ur.soundwireless, ur.createdDate,
ur.gametype, ur.fridgesize, ur.fridgeheight, ur.fridgewidth, ur.fridgedepth, ur.fridgetype, ur.fridgeexterior,
ur.washsize, ur.washheight, ur.washwidth, ur.washdepth, ur.washtype, ur.washexterior, DATEDIFF( DATE_ADD( n.created_date, INTERVAL n.days
DAY ) , NOW( )+ INTERVAL 0 HOUR ) AS daysLeft, TIMESTAMPDIFF( HOUR , NOW( )+ INTERVAL 0 HOUR , DATE_ADD( n.created_date, INTERVAL n.days
DAY ) ) AS hoursLeft,
TIMESTAMPDIFF( MINUTE , NOW( )+ INTERVAL 0 HOUR , DATE_ADD( n.created_date, INTERVAL n.days
DAY ) ) AS minutesLeft, u.phoneNumber, ur.hasBid, ur.numItems, ur.electricity, ur.gas, ur.solar, ur.concession, ur.phone,
b.amount, COALESCE(b.bidAccepted, 0) AS bidAccepted, b.amount, b.powerCents, b.powerFee, b.powerDiscount, b.gasCents, b.gasFee, b.gasDiscount, b.additionalInfo, COALESCE(b.isLowestBid, 0) as isLowestBid, uri.imageName, ura.fileName, ih.address as homeinsaddress, ih.built, ih.propertyValue, ih.dwelling, ih.insurance, ih.moving, ih.owner, ih.previousClaimSelected as homeClaimSelected, ih.previousClaim as homeClaim, ih.requiredby as homeinsrequiredby,
ic.registration, ic.carmake, ic.carmodel, ic.caryear, ic.carfinance, ic.damage, ic.insured, ic.insurerName, ic.modifications, ic.modsValue, ic.nonstandard, ic.theftdevice, ic.gender, ic.garaged, ic.address as caraddress, ic.insType, ic.useType, ic.useFor, ic.age, ic.dob, ic.licenceYear, ic.estValue, ic.previousClaimSelected, ic.previousClaim, ic.licenceSuspended, ic.additionalDrivers, ic.requiredby as carinsrequiredby,
ip.petname, ip.petbreed, ip.petdesexed, ip.petgender, ip.pettype, ip.petborn, ip.petrequiredby, ip.petEstValue, ip.previousClaimSelected as petClaimSelected, ip.previousClaim as petClaim,
h.address as healthaddress, h.covered, h.coverfor, h.income, h.rebate, h.yearbirth, h.requiredby as healthrequiredby, h.preExisting, h.healthPrimary, ur.categoryId, ur.subCategoryId, f.id as flightId, f.class, f.departure, f.departureDate, f.destination, f.oneWay, f.passengers, f.adults, f.children, f.cheapestFare, f.stopOvers, f.departureTime, f.layover, f.numNights, f.rating, f.details, f.returnDate,
hc.id as hireCarId, hc.driverAge, hc.dropoffDateTime, hc.dropoffLocation, hc.pickup, hc.pickupDateTime, hc.purpose, hc.vehicleType, c.id as cameraId, c.cameraType, c.cameraBrand, c.compactType, c.touchScreen, c.tiltable, c.wifi, c.waterProof, c.memoryCard, c.externalFlash, c.cameraCase, c.extraBattery, c.details as cameraDetails, COALESCE(r.id, 0) as ratingId, tt.taxiType
FROM notifications n
LEFT OUTER JOIN users u ON u.id = n.senderId
LEFT OUTER JOIN user_request ur ON ur.id = n.requestId
LEFT OUTER JOIN bids b ON b.notifId = n.notifId
LEFT OUTER JOIN user_request_images uri ON b.sellerId = uri.userId
LEFT OUTER JOIN user_request_attachments ura ON b.sellerId = ura.userId
LEFT OUTER JOIN insurance_home ih ON ur.id = ih.requestId
LEFT OUTER JOIN insurance_car ic ON ur.id = ic.requestId
LEFT OUTER JOIN insurance_pets ip ON ur.id = ip.requestId
LEFT OUTER JOIN insurance_health h ON ur.id = h.requestId
LEFT OUTER JOIN recreation_flights f ON ur.id = f.requestId
LEFT OUTER JOIN recreation_hirecar hc ON ur.id = hc.requestId
LEFT OUTER JOIN ratings r ON ur.id = r.requestId
LEFT OUTER JOIN taxi_types tt ON ur.taxiTypeId = tt.taxiTypeId
LEFT OUTER JOIN camera c ON ur.id = c.requestId
WHERE (n.sellerTypeId = sellerTypeId and COALESCE(b.bidAccepted, 0) = bidsWon
AND (FIND_IN_SET(ur.subCategoryId, _subCategories) )
AND TIMESTAMPDIFF( SECOND , NOW( )+ INTERVAL 0 HOUR , DATE_ADD( n.created_date, INTERVAL n.days
DAY ) ) > -0 group by n.notifId ORDER BY hoursLeft ASC
而且不存在
选择空值
从通知隐藏nh
其中nh.notifId=n.notifId,nh.sellerId=sellerId
AND TIMESTAMPDIFF( SECOND , NOW( )+ INTERVAL 0 HOUR , DATE_ADD( n.created_date, INTERVAL n.days
DAY ) ) > -0 group by n.notifId ORDER BY hoursLeft ASC
我在理解上有点困难,特别是关于我的sellerId是否存在以及是否不存在的部分。。。您可以发布当前的SELECT语句吗?你已经知道哪个字段,你想检索哪个字段?既然您说它将返回sellerId 1442的行,并带有相同的Notified,这是否意味着您知道Notified?您正在寻找这样的东西:从bids_表中选择*notifId=1260和sellerId=50001Hi,已经添加了查询,已经添加了查询。我用php显示了2个表,表1不包含其他卖家的出价或出价,表2只包含我的出价。如果另一个卖家对我的一个出价出价,我在每个表中都有一行。我不想在表1中显示任何其他人的出价,如果我已经有了相同的通知出价