The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Easy Database Query Question
Hey all,
This is self explanatory I guess. Can someone please fix this for me?? I know I am messing up with the Where clause... HTML Code:
SELECT * FROM userfield AS userfield LEFT JOIN user AS user ON (user.userid = userfield.userid) WHERE user.usergroupid = 15 AND user.userfield = 19, 20, 7, 12, 13, 18, 14, 15, 16, 17, webdevoman --------------- Added 07 Sep 2009 at 23:12 --------------- I think I have it-- Is this it?? PHP Code:
Error SELECT * FROM userfield AS userfield LEFT JOIN user AS user ON ( user.userid = userfield.userid ) WHERE user.usergroupid =15 AND user.userfield = '19' AND '20' AND '7' AND '12' AND '13' AND '14' AND '15' AND '16' AND '17' AND '18', LIMIT 0 , 30 MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' LIMIT 0, 30' at line 4 |
#2
|
||||
|
||||
What is it you want in words? You can't mean that you want user.userfield to equal 19 and to equal 20 and to equal to 7 and equal to ..... especially since there is no column in the user table called userfield. So, why don't you tell us in words what you want because what you have so far is not 'self explanatory'.
|
#3
|
||||
|
||||
OK-
Thanks the numbers are in the "userfield" table and I meant "field20" etc--These are custom profile fields.. I am exporting data from the userfield Table but only from usergroup 15- This part I have already.. Additionally I want to narrow this dump down to eliminate some of the userfield fields... I only want the fields dumped that I listed above.. Does this make more sense??? I am trying to dump some member info into text format. That is the the main goal here.. Thanks and sorry for my miscommunication... |
#4
|
||||
|
||||
It sounds like the select part is wrong then. Perhaps more like this?
Code:
SELECT field19, field20, field7, field12 etc.... FROM userfield as userfield LEFT JOIN user AS user ON (user.userid = userfield.userid) WHERE user.usergroupid = 15 |
#5
|
||||
|
||||
Yeah, That looks a bit closer to what I have been working on the last few minutes.. I will give this a shot and thank you soo much for the help..
|
#6
|
||||
|
||||
Code:
SELECT userfield.userid , userfield.field7 , userfield.field12 , userfield.field13 , userfield.field14 /* , you get the idea */ FROM userfield INNER JOIN user ON user.userid = userfield.userid WHERE user.usergroupid = 15 |
#7
|
||||
|
||||
Lynn, close but I think SirAdrian has it.. I will let you know in a few and thank you both. it was really important that I finish this tonight and I would have been trying alterations of this for hours and hours..lol
I will run this and get back in a few.. Thanks again.. Yeah, that was it SirAdrian.... Geez, looking at my earlier tries, I was waaay off! I guess all of these attempts has taught me a little something so I guess the time spent wasn't a total waste. lol At one point I was soo close. I had everything correct but instead of userfield.field## --I just had field##--I thought that because I clarified the userfield already I didn't have to clarify it again. When I ran that query it was trying to pull field## from the usergroup table and not the userfield table... I understand now.. You both are great.. I appreciate it. I guess it is a good thing that I will be starting a course in mysql in a few weeks.. I am in dire need. webdevoman |
#8
|
||||
|
||||
I Just posted a new thread on this so this can be deleted if needed....
Hey all, This worked great but now I have to add usernames and e-mail addresses to this? Can anyone save me some time on this?? Thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|