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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:06:17+00:00 2026-06-18T12:06:17+00:00

I have model 1 represent a table with (id1,par1, para2 ) and model 2

  • 0

I have model 1 represent a table with (id1,par1, para2 ) and model 2 represent a table with (id2,para3)

I want to modify model 1 in order when I use

$mydata = model1::model()->findBySql('SELECT * FROM table1 ORDER BY id1 DESC');

this query return for me directly only where par1 > par3 (both of them are time), without adding the condition where . Or if thee is a method to add a condition where based in other model ?

  class model1 extends CActiveRecord
   {

public static function model($className=__CLASS__)
{
    return parent::model($className);
}

public function tableName()
  {
    return 'table1';
  } 
  }

Many thanks.

  • 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-18T12:06:18+00:00Added an answer on June 18, 2026 at 12:06 pm

    thanks for all comments, I solve it by using two cdbcreteria and make a condition between them
    see my post here

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

Sidebar

Related Questions

I have made use of the adjacency model to represent a child/parent relationship. It
In my Yii application, I have a model that represents siteconfig table and have
I have a data model that represents a weekly order. Eg. my order might
I want to represent clubs which have multiple members (each member can also join
I have 2 tables that represent 2 different model simulations. As back ground info
I'm currently using (or trying to use) a lookup table to represent a column
I have the following DB model: **Person table** ID | Name | StateId ------------------------------
I have groups ( Group model) in my app, which represent groups of people.
I have my entities such as Customer, Order etc. defined in my Domain Model.
Say I have a table called media to represent audios, images, and videos. Furthermore,

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.