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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:36:35+00:00 2026-05-26T23:36:35+00:00

i am building query in kohana framework which looks like this: DB::select(‘users.email’)->from(‘users’, ‘roles_users’)-> where(‘users.id’,

  • 0

i am building query in kohana framework which looks like this:

DB::select('users.email')->from('users', 'roles_users')->
where('users.id', '=', 'roles_users.user_id')->
and_where('roles_users.role_id', '=', '2');

it would output:

SELECT `users`.`email` FROM `users`, `roles_users` 
WHERE `users`.`id` = 'roles_users.user_id' 
AND `roles_users`.`role_id` = '2'

so my problem is that kohana puts ' ' for me on roles_users.user_id so mysql searches for text not for actual value of the field. is there any way to solve it?

  • 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-26T23:36:36+00:00Added an answer on May 26, 2026 at 11:36 pm

    Is there a reason you are not joining the other table? Like that:

    DB::select('users.email')
    ->from('users')
    ->join('roles_users', 'LEFT')
    ->on('users.id', '=', 'roles_users.user_id')
    ->where('roles_users.role_id', '=', '2');
    

    If you don’t like that, try

    DB::select('users.email')
    ->from('users', 'roles_users')
    ->where('users.id', '=', DB::expr('roles_users.user_id'))
    ->and_where('roles_users.role_id', '=', '2');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an ObjectQuery like this: string query = select value obj from
I'm building a quick csv from a mysql table with a query like: select
I have this Type of Query, select StateName ,countryName from country_master left join state_master
I have built a NamedQuery that looks like this: @NamedQuery(name = EventLog.viewDatesInclude, query =
In sql 2005, instead of building a query from dateparts year, month and date,
I have this query: criteria = session.CreateCriteria(typeof (Building)) .CreateAlias(Estate, estate) .SetProjection(Projections.ProjectionList() .Add(Property.ForName(Name), BuildingName) .Add(Property.ForName(estate.Name),
How to construct sqlite query containing ampersand in filter: SELECT id FROM mediainfo WHERE
I'm busy building an MVC application in PHP using Kohana MVC framework, and it
I'm thinking of building query from these 2 tables (on SQL Server 2008). I
I'm trying to switch from building query strings and calling mysql_query() and embrace PDO.

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.