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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:53:06+00:00 2026-05-13T17:53:06+00:00

In a View i have a table of users combining data from multiple database

  • 0

In a View i have a table of users combining data from multiple database tables. The important tables are Users and Invitations. Im performing a join

LEFT JOIN invitations ON (users.id = invitations.invitee_id)

which gives me access to users.invitee_id, but i also have dynamic search parameters in my query and i cant search for an inviter by email because the inviter email is determined by using the invitee_id joined with the users table on user id.

How can search for the inviter by email?

heres the entire query

    ["SELECT users.id, users.login, users.email, invitations.inviter_id, FROM users 
      LEFT JOIN invitations ON (users.id = invitations.invitee_id)
      WHERE (users.email LIKE ? OR users.id LIKE ? OR users.login LIKE ?)",
      "%#{params[:search]}%","%#{params[:search]}%","%#{params[:search]}%"]

schema

USERS: id, login, email

INVITATIONS: id, inviter_id, invitee_id

  • 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-13T17:53:06+00:00Added an answer on May 13, 2026 at 5:53 pm

    Join Users one more time

     .... LEFT JOIN users u2 ON (invitations.inviter_id = u2.user_id) 
     WHERE ... AND u2.user_name =[your condition] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple tables in my database. Let's say the table users looks like
I have a database with a table users. I generate the EF .edmx from
Requirements : I have a table of several thousand questions. Users can view these
I have implemented a table view with multiple threads. Currently when a user taps
I have table View with grouped style with three sections. Get information from dictionary
I have a table of users called Users And a view called UsersActive that
I have a table of Users, Each USR_ID can have multiple Roles,Views,Brands and Units.
I have a users table, and a view table which lists some user ids...
I have a table that I need to get some specific data from for
i have table car_types ,a Controller users_controller, model Car_type and action url localhost/carsdirectory/users/dashboard dashboard.ctp(view)

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.