camelCase
The Case of the Mysterious Camel.
- Reaction score
- 362
I have two tables:
+ server
+ users
Table 'server' has some info. like whether users are allowed to log in (allow_login).
Table 'users' just has some info. about each user, including their username and password.
I've never used nested queries (I think you call them that) because I never saw the use for them until now.
I can't think of any way to do a few things unless I run two queries.
Is there a way to do the following using just one query?
#1:
If query A returns only one row, run query B (can be a select/update statement on a different table)
#2:
If query A returns no results, run query B (can be a select/update statement on a different table)
#3:
If query A returns a certain value, don't run query B
Like, say, if 'allow_login' is "false" in table 'server', all attempts to log in will fail.
I'm kinda' playing around with C#, MySQL connector/.NET and prepared statements =x
+ server
+ users
Table 'server' has some info. like whether users are allowed to log in (allow_login).
Table 'users' just has some info. about each user, including their username and password.
I've never used nested queries (I think you call them that) because I never saw the use for them until now.
I can't think of any way to do a few things unless I run two queries.
Is there a way to do the following using just one query?
#1:
If query A returns only one row, run query B (can be a select/update statement on a different table)
#2:
If query A returns no results, run query B (can be a select/update statement on a different table)
#3:
If query A returns a certain value, don't run query B
Like, say, if 'allow_login' is "false" in table 'server', all attempts to log in will fail.
I'm kinda' playing around with C#, MySQL connector/.NET and prepared statements =x