Below is a complex view. Note the hard coded values in red. I need to replace these w. variables if possible. Otherwise if the select is set to match fields, the view chokes - even in Navicat. Is there a way to do this? So, when a grid based upon this view is loaded, I would like to pass arguments into it, or pass values back to MySql so that only a small subset of the (otherwise humoungous) data set is returned.
Code:
SELECT `aaia`.`apps_master`.`AmApplicationPosition` AS `AmApplicationPosition`, `aaia`.`apps_master`.`AmPartNum` AS `PartNum`, round( `entapp`.`part_price`.`PpPrice`, 2 ) AS `Jobber`, round( ( `entapp`.`part_price`.`PpPrice` * ( ( `entapp`.`account_discount`.`ADDISCOUNT` * 0.01 ) + 1 ) ), 2 ) AS `Net`, round( `entapp`.`part_price`.`PpCorePrice`, 2 ) AS `Core`, `aaia`.`apps_master`.`AmApplicationNote` AS `AmApplicationNote`, `aaia`.`apps_master`.`AmApplicationQty` AS `AmApplicationQty`, `entapp`.`part_master`.`PmGroupCode` AS `PmGroupCode`, `aaia`.`apps_master`.`AmBaseVehicleID` AS `AmBaseVehicleID`, `aaia`.`apps_master`.`AmSubModelID` AS `AmSubModelID`, `entapp`.`account_discount`.`ADGRPCODE` AS `ADGRPCODE`, `entapp`.`account_discount`.`ADDISCOUNT` AS `ADDISCOUNT`, `entapp`.`account_discount`.`ADPRICESHE` AS `ADPRICESHE`, `aaia`.`application_position`.`PositionName` AS `PositionName`, `entapp`.`part_status`.`PsStatus` AS `PsStatus` FROM ( ( ( ( ( `aaia`.`apps_master` JOIN `entapp`.`part_price` ON ( ( `entapp`.`part_price`.`PpPartNum` = `aaia`.`apps_master`.`AmPartNum` ) ) ) JOIN `entapp`.`part_master` ON ( ( `entapp`.`part_master`.`PmPartNum` = `aaia`.`apps_master`.`AmPartNum` ) ) ) JOIN `entapp`.`account_discount` ON ( ( `entapp`.`account_discount`.`ADGRPCODE` = `entapp`.`part_master`.`PmGroupCode` ) ) ) JOIN `aaia`.`application_position` ON ( ( `aaia`.`application_position`.`ApplicationPosition` = `aaia`.`apps_master`.`AmApplicationPosition` ) ) ) JOIN `entapp`.`part_status` ON ( ( `aaia`.`apps_master`.`AmPartNum` = `entapp`.`part_status`.`PsPartNum` ) ) ) WHERE ( ( `aaia`.`apps_master`.`AmPartNum` = `entapp`.`part_price`.`PpPartNum` ) AND ( `aaia`.`apps_master`.`AmBaseVehicleID` = [COLOR=#ff0000][B]5181[/B][/COLOR] ) AND ( `entapp`.`account_discount`.`ADACCOUNT` = [COLOR=#ff0000][B]10210[/B][/COLOR] ) AND ( `entapp`.`part_master`.`PmGroupCode` = `entapp`.`account_discount`.`ADGRPCODE` ) ) ORDER BY `aaia`.`apps_master`.`AmApplicationPosition`
Comment