0

I have the MySQL command

SELECT Name FROM `User_Info` WHERE username="USERNAME" AND password="PASSWORD"

But I was wondering how I could specify multiple SELECTS.

For example:

SELECT Name AND email FROM `User_Info` WHERE username="USERNAME" AND password="PASSWORD"

Please Help!

5 Answers 5

1

You can separate return fields by commas.

SELECT Name, email 
FROM User_Info WHERE username="USERNAME" 
AND password="PASSWORD"

You might want to consider looking for an SQL tutorial. This is not really the right forum for these types of questions.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for you answer, and I apologize if this wasnt supposed to be posted here.
0

Have you tried using a comma?

SELECT Name, email FROM `User_Info` WHERE username="USERNAME" AND password="PASSWORD"

If you're stumped on this you really need to invest in a decent SQL reference.

Comments

0

You only need to separate the fields with a comma.

Select name, email, password from user_info where username = "USER" and password = "PASS"

In case you want to select all fields only use *

Select * from user_info

Comments

0

You would do the following:

SELECT Name, email FROM `User_Info` WHERE username="USERNAME" AND password="PASSWORD"

The full details on the SELECT statement can be found here: http://dev.mysql.com/doc/refman/5.0/en/select.html

Comments

0

You can find it here in the manual.

What you'd need it

SELECT Name, email
FROM `User_Info`
WHERE username="USERNAME"
    AND password="PASSWORD"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.