Jump to content
Sign in to follow this  
niche

Not exists with concatenated columns

Recommended Posts

This code works with cols that are not concatenated:

 

SELECT  
		item3 
	FROM    
		nconnectz t1
	WHERE   
		NOT EXISTS
			(
				SELECT  
					item3
				FROM    
					itemandsize t2
				WHERE   
					t1.item3 = t2.item3
        )
	GROUP BY item3

I think this is the same query with concatenated columns

 

SELECT  
		CONCAT_WS(',', itemandsize, pkg_quantity) item4 
	FROM    
		nconnectz t1
	WHERE   
		NOT EXISTS
			(
				SELECT  
					CONCAT_WS(',', itemandsize, '0.00') item4
				FROM    
					itemandsize t2
				WHERE   
					t1.item4 = t2.item4
        )
	GROUP BY item4

the error is: Unknown column 't1.item4' in 'where clause'

what's causing the error?

Share this post


Link to post
Share on other sites

Voila !

 

SELECT  
		nconnectz.itemandsize, nconnectz.pkg_quantity
	FROM    
		nconnectz  
	WHERE   
		NOT EXISTS
			(
				SELECT  
					*
				FROM    
					itemandsize  
				WHERE   
					CONCAT_WS(',', nconnectz.itemandsize, nconnectz.pkg_quantity)  = CONCAT_WS(',', itemandsize.itemandsize, '0.00')
        )

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...