vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Desperate for help with query using IN condition... (https://vborg.vbsupport.ru/showthread.php?t=137704)

Antivirus 01-28-2007 01:33 AM

Desperate for help with query using IN condition...
 
I'm trying to debug this alll day, if anyone can help i'll be very very happy.

My query is as follows:
PHP Code:

$sql $db->query_read("
    SELECT * FROM " 
TABLE_PREFIX "task AS task
    WHERE 3 NOT IN (task.taskfilter)
    ORDER BY name ASC
"
); 

In my table, i have several rows & values such as the following:
taskid name taskfilter
---------------------------------------------
1 foo 4,13,22
2 baa 5,3,101
3 moo 3
4 goo 1,56,87
and so on...

my problem is that I need my result from the query to contain only rows that DO NOT have the value 3 in the taskfilter column so I only want rows 1 and 4 to return.
problem is that row 1 is being excluded as well, since there's a 3 in the number 13. What am i missing here?:confused:

calorie 01-28-2007 02:04 AM

Untested...
Code:

$sql = $db->query_read("
        SELECT * FROM " . TABLE_PREFIX . "task AS task
        WHERE NOT FIND_IN_SET('3', task.taskfilter) > 0
        ORDER BY task.name ASC
");


Antivirus 01-28-2007 02:16 AM

Thank you Calorie... that worked perfectly
http://www.eclipserecords.com/forum/...es/bowdown.gif

Dismounted 01-28-2007 02:57 AM

PHP Code:

$sql $db->query_read("
    SELECT * FROM " 
TABLE_PREFIX "task AS task
    WHERE task.taskfilter <> 3
    ORDER BY name ASC
"
); 

Wouldn't that work aswell?


All times are GMT. The time now is 01:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01127 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete