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 7591063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:33:47+00:00 2026-05-30T20:33:47+00:00

I have a table A, with just two columns: ‘id’ and ‘probably’. I need

  • 0

I have a table A, with just two columns: ‘id’ and ‘probably’. I need to go over a long list of ids, and determine for each one whether he is in A and has probability of ‘1’. What is the best way to do it?

I figured that it would be best to have 1 big query from A in the beginning of the script, and after that when I loop each id, I check the first query. but than i realized I don’t know how to do that (efficiently). I mean, is there anyway to load all results from the first query to one array and than do in_array() check? I should mention that the first query should had few results, under 10 (while table A can be very large).

The other solution is doing a separate query in A for each id while I loop them. But this seems not very efficient…

Any ideas?

  • 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-05-30T20:33:48+00:00Added an answer on May 30, 2026 at 8:33 pm

    If you have the initial list of ids in array, you can use the php implode function like this:

    $query = "select id 
              from A
              where id in (".implode (',', $listOfIds).")
              and probability = 1";
    

    Now you pass the string as first parameter of mysql_query and receive the list of ids with probability = 1 that are within your initial list.

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

Sidebar

Related Questions

Lets say I have a table with just two columns: name and mood .
I have a table with two columns where I need one ( columnB )
We have a 10 thousand row table that has just 2 columns, a primary
I need to style a table to have rounded corners. I'm just looking at
I have a table with two columns: attribute and value! Attribute is an enum.
Say you have table of some items with these two columns: ItemName Price ....where
I have one table: dbo.Product Two columns: SKU Name --- ---- 100A-B (F102397) 1
I have a table containing two columns in SQL that I want to extract
I have a table with three columns fk_id, sort_column, value_column for each fk__id_ I'd
So I have a table with two columns title and url. The rows go

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.