jeudi 13 août 2015

MySQL: How can I check whether Users are listed or not

I was wondering how I can check whether users are already in the database or not.

In PHP I have an array with some UserIDs. i.e. userIDs[0] = 1234; userIDs[1] = 2345;

Now I wanted to build a query to make just one sql call if possible to get following result:

############################
#    UserID    #   Exists  #
############################
#     1234     #     0     #
#     2345     #     1     #
############################

Is there a sql solution or do I have to check each ID with a seperate call? Thank you for your help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire