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

  • Home
  • SEARCH
  • 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 3451762
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:10:50+00:00 2026-05-18T09:10:50+00:00

Here’s the table structure table : user id name email category table 2 :

  • 0

Here’s the table structure

table : user
id
name
email
category

table 2 : body
id
uid
height
haircolor

Here’s how i access the data from the database
SELECT * FROM user WHERE category='paid' and with more codes it works.

What i want to do is like this (i..e allow complex search)

Select * FROM user WHERE category='paid' body.height='5ft', body.haircolor='red' WHERE user.id=body.uid

I know the statement is wrong, but i want the database to be searchable such that i can select haircolor as red, height as 5ft and the script should only return user(s) whose height is 5ft and haircolor is red (exact match)

I hope you guys understand my question.

P.S : As you can see i have used 2 tables, 1 to store user info and 2 to store user body info. I can integrate them into 1 but i want to keep it as it is.

  • 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-18T09:10:50+00:00Added an answer on May 18, 2026 at 9:10 am

    You can actually do something very similar to what you’re doing above – you just use multiple tables in your FROM construct. It’s a great way when you want to pull something out quickly.

    SELECT user.* FROM user, body 
        WHERE user.category = 'paid' 
        AND body.height = '5ft' 
        AND body.haircolor = 'red' 
        AND user.id = body.uid
    

    Remember to specify the SELECT in this instance – everything from the user table. You could also do this with a JOIN, although I have a phobia of them so tend to use the previous method.

    SELECT * FROM user 
        WHERE user.category = 'paid' 
        AND body.height = '5ft' 
        AND body.haircolor = 'red'
        JOIN body ON user.id = body.uid
    

    That should do the trick! As I said, I despise using JOINs, and the former should be absolutely fine.

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

Sidebar

Related Questions

Here is an example table: ID time data type 0 0100 xyz 0 1
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here I had a problem that I am adding contact from the address book
Here is my situation. My solution structure is as follows. Project Used to handle
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is my code, which takes two version identifiers in the form 1, 5,

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.