vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need help with a query (https://vborg.vbsupport.ru/showthread.php?t=76099)

Michael Morris 02-10-2005 07:09 PM

Need help with a query
 
Here it is

[sql]SELECT * FROM post
WHERE userid = 1
AND postid IN SELECT reviewids from product where productid = 3 [/sql]

The product table has a field called reviewids which is a list of reviewsids in this format 980,1020,2212

I know I can execute a single query to grab the ids and a second query to make this check (which should return true or false), but I'd rather do it in one query if I can.

Dean C 02-10-2005 08:50 PM

Nothing wrong with a subquery if you can do it :)

sabret00the 02-10-2005 09:18 PM

wouldn't he need to explode and FIND_IN_SET the original listed data if it's in the format of 454,5656,34232,134?

Dean C 02-11-2005 07:43 AM

If he's using MySQL4 then he can use subqueries :) Personally for scalability I'd get a list of ID's, and then use WHERE productid IN($ids)

Michael Morris 02-11-2005 03:35 PM

Ah.. Well, I'm not using 4+. I broke it in half pretty much as you described Dean. Thx.


All times are GMT. The time now is 11:38 PM.

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.01016 seconds
  • Memory Usage 1,707KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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