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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:16:35+00:00 2026-06-16T22:16:35+00:00

I have tables: driver, driver_negotiation, base_negotiation and team In DriverController model I want to

  • 0

I have tables: driver, driver_negotiation, base_negotiation and team

In DriverController model I want to get the team_id (which is located in base_negotiation) that the driver is negotiating with.

In Driver model I have:

'driverNegotiation' => array(self::HAS_ONE, 'DriverNegotiation', 'driver_id')

And in DriverNegotiation:

'baseNegotiation' => array(self::BELONGS_TO, 'BaseNegotiation', 'base_negotiation_id')

In DriverController I am building something like:

$criteria=new CDbCriteria(array(
    'condition' => 'baseNegotiation.team_id=13',
    'with' => 'driverNegotiation',
    'together' => true,

));

But I get:

Column not found: 1054 Unknown column 'baseNegotiation.team_id' in 'where clause'. 
The SQL statement executed was: SELECT COUNT(DISTINCT `t`.`id`) FROM `driver` `t` 
LEFT OUTER JOIN `driver_negotiation` `driverNegotiation` ON 
(`driverNegotiation`.`driver_id`=`t`.`id`) WHERE (baseNegotiation.team_id=13) 

So I can get everything from the driver_nagotiation table, but nothing from one table further.

Do I need to use join to get the correct stuff or is there a better way?

  • 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-06-16T22:16:36+00:00Added an answer on June 16, 2026 at 10:16 pm
    'with' => 'driverNegotiation.baseNegotiation'
    

    This did the trick.

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

Sidebar

Related Questions

I have a database with tables and values. I want to fetch that data
I have an ETL that is importing tables from Oracle to SQL 2008 using
I have a web-site that generates some simple tabular data as html tables, many
We have an application that creates a number of Visual Foxpro (DBF) tables. Each
I have a view defined in SQL server 2008 that joins 4 tables together.
Suppose I have a custom file format, which can be analogous to N tables.
i have tables driver, cars and trailers they are all in relationship. and main
I have two tables named t1 and t2, which content list as following: mysql>
So imagine i have two tables, Car and Driver, with respectively these structure :
I have two tables drivers and drivers_names . What I want is for every

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.