View Single Post
Old 05-24-11, 11:54 AM   #97
Penguin
Ocean Warrior
 
Penguin's Avatar
 
Join Date: Mar 2010
Location: Rheinische Republik
Posts: 3,322
Downloads: 92
Uploads: 0


Default

Quote:
Originally Posted by Neal Stevens View Post
Thanks so much for the help. I am going to have a look at those course, I find SQL very interesting, I just never got on track with a tutorial that I could follow.

Question: in your query, you stated
SELECT *(all infos, or whatever you need)
The info I would want to select would be userID, signature, homepage, right?
np!
With the star it would show you all infos available (all columns) from both tables. If you want to use this statement to find the homepages it would just be something like this: SELECT U1.userpage - this would be usefull for a list of the userpages. To select more, just put a comma between, select U1.userpage, S1.signature, U1.shoesize, etc

Quote:
Originally Posted by Neal Stevens View Post
FROM User AS U1 INNER JOIN Sigparsed AS S1 (just abbreviations to type less)
Abbreviations for what? Or did you simply give the join names really short names, like U1 ? That makes sense.
yes, it just gives short names for the tables in this search query, helps to avoid typing long names for the lazy ones This is helpfull if you want to join several tables. If you want to use the real table names, just delete the "AS..."

Quote:
Originally Posted by Neal Stevens View Post
AND U1.Totalposts < 2
That means any member with 1 post will not be selected, right? I can change that to < 1 and select all the 0 post users, right?
In the example, it would select all users with no or one posts. I thought this would make sense, as we saw today, many spammers make one post, however I think those accounts get vaporized eventually .
If you want to select the users with no posts, you use either "= 0", "<1", or "IS NULL". It depends on how the totalposts column looks if a new user is created. If the db puts a 0 (numeric zero) into that column in the moment a new user registers, you can use one of the first two statements. If the column is empty untill the first postcount is written into it, you have to use the IS NULL statement.
Penguin is offline   Reply With Quote