The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Retrieve values from 2 tables with minimal queries
I am trying to figure out how do a query where I would use one of thevalues from one query to access a value in another table with as littlequeries as possible. Just to make things simple, I'll use actualtable/field names.
I plan to run a query that fetches all values from the table'lmd_draftpicks' The main variable is pickid, which is the number ofthe draft pick involved. In that table I've got a variable namedteamid, which is the # correlating to an NFL team. The first way that popped into my head is to assign the value of theteamid to a random variable such as x, then run another query to fetchthe name of the team where teamid = x. That results in 2 queries per draft pick. Is there a way to do this with 1 query per pick, or so less overall queries are used? Finally, to see if I'm doing this right, once I have the team nameselected, could I then replace the teamid variable in the first querywith the teamname? (I'm sure some of this is simple to you guys, but I am still trying to learn PHP/MySQL). Thanks in advance. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|