Programmers Language v2
  • Home
  • Language
  • Items
  • Matrix (BETA)
  • About
  • Register
  • Login
Home » PlGroups » Yii2-ActiveQuery

View PlGroup Yii2-ActiveQuery

ID45
TextYii2-ActiveQuery
TitleYii2-ActiveQuery

PlItems

  • <?php /* SQL Example: SELECT * FROM `Cities` WHERE (`postalcode_id` IN (SELECT `id` FROM `postalcodes` WHERE `postalcode`='12345') ) OR (`region_id` IN (SELECT `id` FROM `regions` WHERE `region`='North') ) */ $active_query_postalcodes_For_Subselect = \app\models\Postalcodes::find()->select("id")->where(["postalcodes" => '12345']); // Attention! No "->all()" at the end to create a subselect! $active_query_regions_For_Subselect = \app\models\Regions::find()->select("id")->where(["region" => 'North']); // Attention! No "->all()" at the end to create a subselect! $model = new \app\models\Cities(); $all_Cities_With_IN_and_OR = $model::find() ->where(['in', "postalcode_id", $active_query_postalcodes_For_Subselect]) ->orWhere(['in', "region_id", $active_query_regions_For_Subselect]) ->all(); ?>
Operations
  • List PlGroups
  • Create PlGroup
  • Update PlGroup
  • Delete PlGroup
  • Manage PlGroups
Copyright © 2025 by My Company.
All Rights Reserved.
Powered by Yii Framework.