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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:40:41+00:00 2026-05-24T23:40:41+00:00

Hello, I have the following sql table + data: CREATE TABLE IF NOT EXISTS

  • 0

Hello,

I have the following sql table + data:

CREATE TABLE IF NOT EXISTS `job_requires` (  
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,  
   `Job_id` bigint(20) unsigned NOT NULL,
   `Group_Index` int(11) NOT NULL,  
   `Field_id` bigint(20) unsigned NOT NULL,  
   `Field_Value` int(11) NOT NULL,
   PRIMARY KEY (`id`)
) 

INSERT INTO `job_requires` 
    (`id`, `Job_id`, `Group_Index`, `Field_id`, `Field_Value`) 
VALUES
    (1, 7, 1, 11, 50),
    (2, 7, 1, 14, 50),
    (3, 7, 1, 11, 59),
    (4, 7, 2, 14, 1),
    (5, 7, 2, 11, 2),
    (6, 8, 1, 14, 55),
    (7, 8, 1, 11, 50),
    (8, 8, 1, 14, 59),
    (9, 8, 2, 11, 60),
    (10, 8, 2, 14, 61);

I need to get all ‘Job_id’ by filtering that based on the ‘Field_id’+’Field_Value’ fields.
I want the query to be somthing like:

SELECT job_requires.Job_id 
FROM job_requires 
WHERE (Field_id=11 AND Field_Value=50) AND (Field_id=14 AND Field_Value=1)

My problem is that I want query to be based also on the Group_Index field:
Only if ‘Job_id’ in my previous query have both conditions, and those conditions have the same Group_Index It should be in the query’s result.

UPDATE: I don’t know how many filters the query will have, it could be also:

SELECT job_requires.Job_id 
FROM job_requires 
WHERE (Field_id=11 AND Field_Value=50) AND (Field_id=14 AND Field_Value=1) AND (Field_id=16 AND Field_Value=56) AND (Field_id=12 AND Field_Value=26)

I hope you understand my problem, because my english is not great 🙁

Thank you very much

  • 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-24T23:40:42+00:00Added an answer on May 24, 2026 at 11:40 pm
    SELECT j1.Job_id
        FROM job_requires j1
            INNER JOIN job_requires j2
                ON j1.Job_id = j2.Job_id
                    AND j1.Group_Index = j2.Group_Index
        WHERE j1.Field_id = 11 AND j1.Field_Value = 50
          AND j2.Field_id = 14 AND j2.Field_Value = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data: A post called Hello has categories greet Another post
If I have data in the following format id subid text 1 1 Hello
Hello I have following columns in mysql table: rating1, rating2, price, cond, approved Is
Hello I have the following code to retrieve data from my db using nhibernate
Hello I have the following function that is NOT working at the moment.. What
Hello I have the following piece of code and it won't post the data
Hello I have the following php script $db =& JFactory::getDBO(); $sql = select uid
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
I have following code snippet: class ABC{ public: int a; void print(){cout<<hello<<endl;} }; int

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.