The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Any ideas on this mysql query?
Hi to all on this great site! I am desperate for some help:
PHP Code:
$proname has a list of values in s_sur. I want to query the database to see who else has the same values and then display the results excluding $proname's own results. This does work but is TERRIBLY slow. Is there another way to do this? Any help is greatly appreciated. Thank you. |
#2
|
|||
|
|||
Maybe i misread it, but on first sight this doesn'tmake sense at all.
In the sub-query you select all surnames (assumption) that have a first name $proname. With the resulting surnames, you select again from the $stb table, and want to list all with the selected surnames, but who don't have a first name of $proname. That should result in an empty resultset. |
#3
|
|||
|
|||
Hi Marco,
$proname (s_name) is the username of the person who entered the s_sur (surname) records. I want to query the db to see who else has entered the same (surnames) s_sur as $proname and return the results. But I want all surnames from $proname exluded. Does that make more sense? |
#4
|
|||
|
|||
Sorry but no.
You want to list all surnames that have $proname, but exclude those that have $proname. |
#5
|
|||
|
|||
LOL,
Basically, I (I am $proname, s_name) have entered numerous surnames into the database (s_sur). I want to see if any other users have entered the same surnames as I have and have the database show the rusults to me but I dont want to see my own entries, only other members entries. So, I have to do a query to get ALL the surnames I have entered and then put that into another query to see who else has the same surnames. How about that? The query DOES work, it's just slow. |
#6
|
|||
|
|||
Are there any indexes on these columns?
|
#7
|
|||
|
|||
Yes s_sur and s_name
This has speeded it up alot. Could it be faster? |
#8
|
|||
|
|||
The subquery is probably causing the slow load times and is probably not even necessary if your table is normalized enough.
If you have an id associated with the user who submitted the data, you can just do a simple select using the s_name and s_sur of the user with a conditional to exclude records submitted by that user id. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|