Yii Framework Forum: Cara Ubah Nested SQL ke Criteria - Yii Framework Forum

Jump to content

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

Cara Ubah Nested SQL ke Criteria Criteria Rate Topic: -----

#1 User is offline   Limpat Prananda 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 31-May 12

Posted 31 May 2012 - 12:21 PM

Mau tanya saya punya SQL seperti ini

"SELECT *
FROM(
SELECT flg.FLG_USRID AS id
FROM following flg
WHERE USR_ID = " . $id . "
) fol, STATUS s
WHERE fol.id = s.USR_ID
ORDER BY s.STS_ID DESC
LIMIT 0,10";


awalnya pakek Yii::app()->db->createCommand($sql)->queryAll(); untuk mengeksekusi tapi bagaimana caranya pakek criteria ya? soalnya extension pagination harus pakek criteria
0

#2 User is offline   xent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 14-November 10

Posted 31 May 2012 - 08:03 PM

ngapain pakek criteria? pagingnya bisa pakek cara ini
xent

My first app: School Information System
Find error? Post here
My Blog
0

#3 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 13 June 2012 - 06:36 AM

kurang lebih begini tp ga tw sesuai yang dimaksud ga heheheh,,

$sql="
	SELECT name . . . . FROM tbl_bank WHERE . . . . )
	";
	$dataProvider=new CSqlDataProvider ($sql, array(
	'totalItemCount'=>$count,
	'sort'=>array(
				'attributes'=>array(
	'post','company','beneficiary_account','type',
				),
			),
			'db'=>Yii::app()->db,
			'pagination'=>array(
				'pageSize'=>30,
			),
		));

0

#4 User is offline   ahmadroni 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 250
  • Joined: 14-June 09
  • Location:Yogyakarta-Indonesia

Posted 15 June 2012 - 08:56 PM

wah sudah di jawab rupanya.. ane mantau gan..!
Hospital Cost Management System and
Hospital Management Information System
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