Well, I have very limited experience with MySQL, but, in general (i.e., with the other 5 or 6 DBMSes I've used), you do
not have to SELECT a column in order to use it in the WHERE clause. It seems very, very odd to me to think that MySQL would have that kind of restriction.
I'll check over your script in a little more detail and see if I spot anything.
MrCromeDome
Update #2: I deleted my original update as I was totally mistaken. . . I don't use SQL aliasing much, and inadvertantly took you down a wrong path. Albannach pointed it out to me, so vote his nodes up, not mine ;)
He pointed out that you can't use column aliases at all in a WHERE clause. I know your error doesn't specifically seem to relate to an aliasing issue. . . but eliminating the alias never hurts ;) Perhaps try:
select csGroups.ID as groupid,csUsers.UserName as username,csUsers.ID
+as id,csGroups_lang.Title as grouptitle from csGroups_lang,csUsers,cs
+Groups,csUsers_Groups where csGroups.ID = csGroups_lang.ID and csUser
+s.ID = csUsers_Groups.UserID and csGroups.ID = csUsers_Groups.GroupID
+ and (csUsers.ID IN (1,2)) order by username asc limit 0,10
and see what happens.
Hope this helps!
MrCromeDome
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.