So I have joined a few tables together and I am having some issues. Here is my sql:
SELECT co.orderid,
orderdate,
emailaddr,
city,
weight,
partdescription
FROM customer c
INNER JOIN custorder co ON c.customerid = co.customerid
INNER JOIN custorderline cl ON co.orderid = cl.orderid
INNER JOIN inventorypart i ON cl.partnumber = i.partnumber
WHERE orderdate BETWEEN to_date('2015/11/01', 'yyyy/mm/dd') AND to_date('2015/11/30', 'yyyy/mm/dd')
AND emailaddr LIKE '%gmail%'
OR emailaddr LIKE '%outlook%'
AND categoryid IS NOT NULL
AND weight > 30;
here are some results:
ORDERID ORDERDATE EMAILADDR CITY WEIGHT PARTDESCRIPTION
---------- --------- -------------------------------------------------- -------------------- ---------- --------------------------------------------------
2000000351 30-NOV-15 vacation@gmail.com Walla Walla .5 MINI TOWER CASE
2000000351 30-NOV-15 vacation@gmail.com Walla Walla 34.44 EAGLE Z240 XEON E3
2000000354 01-DEC-15 jmuench@outlook.com Miami 34.44 EAGLE Z240 XEON E3
2000000224 07-OCT-15 findwork@outlook.com Asheville 34.44 EAGLE Z240 XEON E3
2000000279 01-NOV-15 analyzeh20@gmail.com Sumter .438 BOARD GAMES
2000000279 01-NOV-15 analyzeh20@gmail.com Sumter .375 INTERNET SECURITY
2000000298 08-NOV-15 mswatson@gmail.com Ogden 27.32 EAGLE PRETIEGE 9000
2000000311 12-NOV-15 syarian@gmail.com Whales .5 2GB RADEON R7 350 VIDEO CARD
2000000316 16-NOV-15 mouse@gmail.com Charleston .375 FLASH WING OPTICAL GAMING MOUSE
2000000320 17-NOV-15 jjones@gmail.com Burns .188 HDMI MALE 180 DEG SWIVEL
2000000346 29-NOV-15 sign3@gmail.com
here is what I am trying to accomplish. all orders in november, emails contain gmail or outlook, part numbers must have a categoryid, parts must weight more than 30, and orderid only shows up once.
my issues are that parts weighing less than 30 are still showing up and i somehow need to make it so "If an order appears more than once;list it only once."
This is a hw question that I am stumped on... I've played with it for a long time now, keep coming back to it and think I am just thinking about it wrong. Any help or insight would be appreciated!