Home » SQL & PL/SQL » SQL & PL/SQL » EXISTS statement...
EXISTS statement... [message #391189] Wed, 11 March 2009 07:20 Go to next message
Maverick27
Messages: 84
Registered: October 2008
Member
Somebody pls advise if SQL statement is correct..

Table: MST_ITEM
Cols:
> item_code
> sub_group_code

Table: TEMP_LIGHTING
Cols:
> vc_item_code

I want to find out the records in MST_ITEM that don't have sub group code i.e sub_group_code is NULL and with matching item_code in TEMP_LIGHTING

I wrote this SQL but not getting desired result. I'm pretty sure that there are ITEMS in MST_ITEM without Sub Group Code with matching Item code in TEMP_LIGHING

SELECT *
FROM mst_item
WHERE EXISTS (SELECT *
FROM temp_lighting
WHERE temp_lighting.item_code = mst_item.item_code)
AND NVL(sub_group_code,0) = 0

Is this SQL statement correct ?

Mave
Re: EXISTS statement... [message #391191 is a reply to message #391189] Wed, 11 March 2009 07:23 Go to previous messageGo to next message
pablolee
Messages: 2836
Registered: May 2007
Location: Scotland
Senior Member
Stop posting what is basically the same question, multiple time. Next time, your post will simply be deleted. Continue in the original thread.
Re: EXISTS statement... [message #391193 is a reply to message #391189] Wed, 11 March 2009 07:25 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I agree you are wasting our time managing your posts.

Regards
Michel
Previous Topic: select data within 2 different database
Next Topic: Clob with trim
Goto Forum:
  


Current Time: Sat Dec 10 07:03:42 CST 2016

Total time taken to generate the page: 0.09965 seconds