Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 - 2 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: IN and NOT IN on MySQL < 4.1
by McNaz on 2005/9/22 10:28:01

Quote:
doesn't support subqueries.


That got me too.

The trick with a Not In subquery is to use a left join.

So your query will become:

le="color: #000000"><?php SELECT NGS_ID, NGS_Schaal FROM xoops_survey_normgroepschaal ott left join xoops_survey_normgroepschaalitem inn on ott.NRG_ID = inn.NRG_ID where inn.NRG_ID is null


HTH
IN and NOT IN on MySQL < 4.1
by Antoine on 2005/9/22 7:26:44

Hi,

Currently I am about to implement a module I have been working on. This modules has been developed using MySQL 4.1. Now, however, I have to impelement it on a system that is running an earlier version of MySQL and doesn't support subqueries.

Please, if anyone knows how to rewrite this query so it doesn't use subqueries I'd be most gratefull. I could solve the problem in code but that would at least quadruple the execution time.

le="color: #000000"><?php SELECT NGS_ID, NGS_Schaal FROM xoops_survey_normgroepschaal, xoops_survey_normgroep WHERE NRG_ID = 7 AND xoops_survey_normgroepschaal.VRL_ID = xoops_survey_normgroep.VRL_ID AND NGS_ID NOT IN (SELECT NGS_ID FROM xoops_survey_normgroepschaalitem WHERE NRG_ID = 7) ORDER BY NGS_Schaal

Who's Online

427 user(s) are online (372 user(s) are browsing Support Forums)


Members: 0


Guests: 427


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits