Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE checando (IN Businesstype VARCHAR (30))
- BEGIN
- IF (Businesstype = 'Comprar')
- THEN
- SELECT
- property_configs.`id` AS campaignID,
- property_configs.`value` AS campaignValue,
- properties.`id` AS propertyID,
- properties.`publicCode`,
- properties.`city`,
- properties.`neighborhood`,
- properties.`rentValue`,
- properties.`businessType`,
- properties.`propertyType`,
- properties.`state`
- FROM
- properties
- LEFT JOIN property_configs
- ON (
- property_configs.property_id = properties.id
- )
- WHERE properties.`businessType` = 'SELL' ;
- ELSEIF (Businesstype = 'Alugar')
- THEN
- SELECT
- property_configs.`id` AS campaignID,
- property_configs.`value` AS campaignValue,
- properties.`id` AS propertyID,
- properties.`publicCode`,
- properties.`city`,
- properties.`neighborhood`,
- properties.`rentValue`,
- properties.`businessType`,
- properties.`propertyType`,
- properties.`state`
- FROM
- properties
- LEFT JOIN property_configs
- ON (
- property_configs.property_id = properties.id
- )
- WHERE properties.`businessType` = 'RENT' ;
- ELSE
- SELECT
- property_configs.`id` AS campaignID,
- property_configs.`value` AS campaignValue,
- properties.`id` AS propertyID,
- properties.`publicCode`,
- properties.`city`,
- properties.`neighborhood`,
- properties.`rentValue`,
- properties.`businessType`,
- properties.`propertyType`,
- properties.`state`
- FROM
- properties
- LEFT JOIN property_configs
- ON (
- property_configs.`property_id` = properties.`id`
- ) ;
- END IF ;
- END //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement