Yii Framework Forum: Check If Two Tables Have The Same Column Value - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Check If Two Tables Have The Same Column Value Rate Topic: -----

#1 User is offline   adrianna 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 19-March 14

Posted 03 July 2014 - 08:41 PM

I have two table on my database named Category and User. Both of them have column name 'classification'. The value of classification for both tables came from the model I created getClassification(). Now, how can I check if the two table have the same classification? Is it possible?

Thank you guys.
0

#2 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 358
  • Joined: 23-July 09

Posted 10 July 2014 - 01:37 AM

    $sql = "SELECT COUNT(*) FROM category c, user u where c.classification = u.classification WHERE u.id = " . Yii::app()->user->id;

We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

#3 User is offline   adrianna 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 19-March 14

Posted 10 July 2014 - 01:45 AM

View PostBackslider, on 10 July 2014 - 01:37 AM, said:

    $sql = "SELECT COUNT(*) FROM category c, user u where c.classification = u.classification WHERE u.id = " . Yii::app()->user->id;




Ow. thank you Backslider :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users