Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:34:44+00:00 2026-06-03T22:34:44+00:00

I have a web (intranet) tool that parses a users list into an array

  • 0

I have a web (intranet) tool that parses a users list into an array of first and last names. I’m then looping through that array (which could be 50 times) like:

SELECT * FROM users WHERE last_name = array[x].last AND first_name = array[x].first

Is it possible to somehow query all those first/last name combinations at the same time like an IN statement with two properties.

What I’d love if it was possible is a single query that returned a record set of every match that was found (I guess like an IN statement w/ 2 properties). I’m not that great with MySQL but my guess would be this would be something like having a sub-query gather a list of any first name matches and then another sub-query gathering any last name matches.

You know actually if I just made there query as where first_name IN () OR last_name in () I’d have a result set with any possible match and then I could loop through that result set doing a final check for where the first and last names both match. This db is fast, but it’s massive. For example, there are 8,000+ users

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:34:45+00:00Added an answer on June 3, 2026 at 10:34 pm

    Here is a nice trick with MySQL row constructors:

    CREATE TABLE users (
        first VARCHAR(50),
        last Varchar(50)
    );
    
    INSERT INTO users (first, last) VALUES
    ('Bill', 'Gates'), ('Steve', 'Jobs'), ('Jon', 'Skeet');
    
    SELECT *
      FROM users
     WHERE (first, last) = ('Bill', 'Gates')
        OR (first, last) = ('Steve', 'Jobs')
        OR (first, last) = ('Jon', 'Skeet');
    

    http://sqlfiddle.com/#!2/6ef9a/2

    It also works with IN:

    SELECT *
      FROM users
     WHERE (first, last) IN(
       ('Bill', 'Gates'), ('Steve', 'Jobs'), ('Jon', 'Skeet')
    );
    

    http://sqlfiddle.com/#!2/6ef9a/6

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me share the following scenario: I have a ASP.NET intranet Web-based application that
I have an intranet web app that uses CSS httpFolder to map a webdav
I have a web application set up on our intranet that uses windows authentication
I am developing an intranet web application that provides the users with short quizzes.
i have a web application in that i need to differentiate both intranet and
I have an intranet web project that is currently using the IEWC tabstrip and
For an Intranet application I have a web page save function that can lead
I have a web application (MVC3) that is an Intranet, Main app. The solution
I have a PHP web application on an intranet that can extract the IP
We have created a web application, using ASP.NET, that allows users to upload documents

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.