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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:27:11+00:00 2026-05-18T02:27:11+00:00

table ad: id uid name description 1 1 BMW Z5 good condition 2 1

  • 0

table ad:

id uid name                 description     
1  1   BMW Z5               good condition
2  1   Sell house           new           

table ad_values

id sid    m_input   m_value
1  1      car       BMW
2  1      year      2010
3  1      category  1
4  2      year      2005

How can I search in table ‘ad_values’? For example I need car BMW which build year is 2010. I tried something like this:

SELECT * FROM ad_values
WHERE (m_value='BMW' AND m_input='car') AND (m_input='year' AND m_value='2010') AND (m_input='category' AND m_value='1')
GROUP BY sid

Then I get SID and SELECT from table ‘ad’. But it doesn’t work.

  • 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-18T02:27:12+00:00Added an answer on May 18, 2026 at 2:27 am

    It seems like you want the results to come from table ‘ad’ after providing search query terms for table ‘ad_values’. Is this something like what you want?

    UPDATE

    I fixed the query to correctly return matching records.

    SELECT
        DISTINCT a.*
    FROM
        ad_values v,
        ad a
    WHERE
        v.sid = a.id AND
        (  
            (v.m_value='BMW' AND v.m_input='car') OR
            (v.m_input='year' AND v.m_value='2010') OR
            (v.m_input='category' AND v.m_value='1')
        )
    

    This query should yield the following results:

    id uid name description
    1 1 BMW Z5 good condition

    Sound about right?

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

Sidebar

Related Questions

I have these tables: USER TABLE uid | name | role | | 1
albums table is aid | name | description | privacy | defaultpic | date
This is my table structure fName Friend's Name [Varchar] fUID Friend's ID [Int] UID
DB table User with a column name uid, create a method uid in the
create table person ( name varchar(15), attr1 varchar(15), attr2 varchar(1), attr3 char(1), attr4 int
I have table with following details Table name EMPLOYEE and columns EMPID (PK smallint
I have 3 tables: forums id, name, description threads thread_id, forum_id, user_id, title, content,
I need to list all triggers in SQL Server database with table name and
I have a table names 'emp'. Columns are: uid,emp_name,emp_dept,emp_sal. Now i want to find
I have this table structure: CREATE TABLE users ( uid bigint NOT NULL, first_name

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.