CREATE DATABASE  IF NOT EXISTS `unitedcghs` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `unitedcghs`;
--
-- Host: 127.0.0.1    Database: unitedcghs
-- ------------------------------------------------------


--
-- Temporary table structure for view `lbvw_funds`
--

/*!50001 DROP VIEW IF EXISTS `lbvw_funds`*/;
/*!50001 CREATE TABLE `lbvw_funds` (
  `Effect Date Maint. Bldg. Funds` tinyint NOT NULL,
  `idfunds` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_original_flatowners`
--

/*!50001 DROP VIEW IF EXISTS `a_original_flatowners`*/;
/*!50001 CREATE TABLE `a_original_flatowners` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `c_electricmeter_view`
--

/*!50001 DROP VIEW IF EXISTS `c_electricmeter_view`*/;
/*!50001 CREATE TABLE `c_electricmeter_view` (
  `Id Read` tinyint NOT NULL,
  `Id Owner` tinyint NOT NULL,
  `Date Read` tinyint NOT NULL,
  `Last KWH` tinyint NOT NULL,
  `Present KWH` tinyint NOT NULL,
  `Usage` tinyint NOT NULL,
  `Remarks` tinyint NOT NULL,
  `If Billed` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `b_prsnt_lsh_owners`
--

/*!50001 DROP VIEW IF EXISTS `b_prsnt_lsh_owners`*/;
/*!50001 CREATE TABLE `b_prsnt_lsh_owners` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Status` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `idownership` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `lbvw_wtrmeter`
--

/*!50001 DROP VIEW IF EXISTS `lbvw_wtrmeter`*/;
/*!50001 CREATE TABLE `lbvw_wtrmeter` (
  `Flat & Date Last Read` tinyint NOT NULL,
  `id_w_meter_read` tinyint NOT NULL,
  `last_kl` tinyint NOT NULL,
  `prsnt_klitres` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_orginal2present_new`
--

/*!50001 DROP VIEW IF EXISTS `a_orginal2present_new`*/;
/*!50001 CREATE TABLE `a_orginal2present_new` (
  `Flat_No` tinyint NOT NULL,
  `Freehold-Date` tinyint NOT NULL,
  `OOid` tinyint NOT NULL,
  `OO_Membership` tinyint NOT NULL,
  `OO_Name` tinyint NOT NULL,
  `NMid` tinyint NOT NULL,
  `NM_Membership` tinyint NOT NULL,
  `NO_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `b_leaseholdflats`
--

/*!50001 DROP VIEW IF EXISTS `b_leaseholdflats`*/;
/*!50001 CREATE TABLE `b_leaseholdflats` (
  `Flat_No` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_current_members`
--

/*!50001 DROP VIEW IF EXISTS `a_current_members`*/;
/*!50001 CREATE TABLE `a_current_members` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_presentflatowners`
--

/*!50001 DROP VIEW IF EXISTS `a_presentflatowners`*/;
/*!50001 CREATE TABLE `a_presentflatowners` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `idownership` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_freehold_flatowners`
--

/*!50001 DROP VIEW IF EXISTS `a_freehold_flatowners`*/;
/*!50001 CREATE TABLE `a_freehold_flatowners` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `Ownership_Order` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `lbvw_prsntowners`
--

/*!50001 DROP VIEW IF EXISTS `lbvw_prsntowners`*/;
/*!50001 CREATE TABLE `lbvw_prsntowners` (
  `idflatno` tinyint NOT NULL,
  `idownership` tinyint NOT NULL,
  `current_owner` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `b_freeholdflats`
--

/*!50001 DROP VIEW IF EXISTS `b_freeholdflats`*/;
/*!50001 CREATE TABLE `b_freeholdflats` (
  `idflatno` tinyint NOT NULL,
  `datefreehold` tinyint NOT NULL,
  `membership_no` tinyint NOT NULL,
  `joint_owners` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_leasehold_flatowners`
--

/*!50001 DROP VIEW IF EXISTS `a_leasehold_flatowners`*/;
/*!50001 CREATE TABLE `a_leasehold_flatowners` (
  `Flat_No` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `Owner_Order` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `a_current_nonmembers`
--

/*!50001 DROP VIEW IF EXISTS `a_current_nonmembers`*/;
/*!50001 CREATE TABLE `a_current_nonmembers` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `c_watermeter_view`
--

/*!50001 DROP VIEW IF EXISTS `c_watermeter_view`*/;
/*!50001 CREATE TABLE `c_watermeter_view` (
  `Id Read` tinyint NOT NULL,
  `Id Owner` tinyint NOT NULL,
  `Date Read` tinyint NOT NULL,
  `Last KLit.` tinyint NOT NULL,
  `Now KLit.` tinyint NOT NULL,
  `Usage` tinyint NOT NULL,
  `Remarks` tinyint NOT NULL,
  `If Billed` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `lbvw_elmeter`
--

/*!50001 DROP VIEW IF EXISTS `lbvw_elmeter`*/;
/*!50001 CREATE TABLE `lbvw_elmeter` (
  `Flat & Date Last Read` tinyint NOT NULL,
  `id_e_meter_read` tinyint NOT NULL,
  `last_kwh` tinyint NOT NULL,
  `prsnt_kwh` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `b_prsnt_frh_owners`
--

/*!50001 DROP VIEW IF EXISTS `b_prsnt_frh_owners`*/;
/*!50001 CREATE TABLE `b_prsnt_frh_owners` (
  `Flat_No` tinyint NOT NULL,
  `Freehold_Status` tinyint NOT NULL,
  `Freehold_Date` tinyint NOT NULL,
  `Membership_No` tinyint NOT NULL,
  `Joint_Owners` tinyint NOT NULL,
  `idownership` tinyint NOT NULL,
  `Full_Name` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `lbvw_flatnos`
--

/*!50001 DROP VIEW IF EXISTS `lbvw_flatnos`*/;
/*!50001 CREATE TABLE `lbvw_flatnos` (
  `idflatno` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Final view structure for view `lbvw_funds`
--

/*!50001 DROP TABLE IF EXISTS `lbvw_funds`*/;
/*!50001 DROP VIEW IF EXISTS `lbvw_funds`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `lbvw_funds` AS select concat(`funds`.`datechanged`,_utf8' - ',`funds`.`maintenance`,_utf8' - ',`funds`.`buildingfund`) AS `Effect Date Maint. Bldg. Funds`,`funds`.`idfunds` AS `idfunds` from `funds` order by `funds`.`datechanged` desc */;

--
-- Final view structure for view `a_original_flatowners`
--

/*!50001 DROP TABLE IF EXISTS `a_original_flatowners`*/;
/*!50001 DROP VIEW IF EXISTS `a_original_flatowners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_original_flatowners` AS select `fd`.`idflatno` AS `Flat_No`,`fd`.`datefreehold` AS `Freehold_Date`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners`,concat(`od`.`title`,_utf8' ',`od`.`fullname`) AS `Full_Name` from ((`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) join `ownerdata` `od` on((`os`.`idownership` = `od`.`idownership`))) where (`os`.`idownership` <= 106) */;

--
-- Final view structure for view `c_electricmeter_view`
--

/*!50001 DROP TABLE IF EXISTS `c_electricmeter_view`*/;
/*!50001 DROP VIEW IF EXISTS `c_electricmeter_view`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `c_electricmeter_view` AS select `electricmeter`.`id_e_meter_read` AS `Id Read`,`electricmeter`.`idownership` AS `Id Owner`,`electricmeter`.`date_read` AS `Date Read`,`electricmeter`.`last_kwh` AS `Last KWH`,`electricmeter`.`prsnt_kwh` AS `Present KWH`,(`electricmeter`.`prsnt_kwh` - `electricmeter`.`last_kwh`) AS `Usage`,`electricmeter`.`remarks` AS `Remarks`,`electricmeter`.`if_billed` AS `If Billed` from `electricmeter` order by `electricmeter`.`date_read` desc */;

--
-- Final view structure for view `b_prsnt_lsh_owners`
--

/*!50001 DROP TABLE IF EXISTS `b_prsnt_lsh_owners`*/;
/*!50001 DROP VIEW IF EXISTS `b_prsnt_lsh_owners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `b_prsnt_lsh_owners` AS select `fd1`.`idflatno` AS `Flat_No`,`fd1`.`isflatfreehold` AS `Freehold_Status`,`fd1`.`datefreehold` AS `Freehold_Date`,`os1`.`membership_no` AS `Membership_No`,`os1`.`joint_owners` AS `Joint_Owners`,`os1`.`idownership` AS `idownership`,concat(`od1`.`title`,_utf8' ',`od1`.`fullname`) AS `Full_Name` from ((`flatdata` `fd1` join `ownership` `os1` on((`fd1`.`idflatno` = `os1`.`idflatno`))) join `ownerdata` `od1` on((`os1`.`idownership` = `od1`.`idownership`))) where ((`os1`.`current_owner` = 1) and (`fd1`.`isflatfreehold` = 0)) */;

--
-- Final view structure for view `lbvw_wtrmeter`
--

/*!50001 DROP TABLE IF EXISTS `lbvw_wtrmeter`*/;
/*!50001 DROP VIEW IF EXISTS `lbvw_wtrmeter`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `lbvw_wtrmeter` AS select concat(`os`.`idflatno`,'  -  ',`wm`.`date_read`) AS `Flat & Date Last Read`,`wm`.`id_w_meter_read` AS `id_w_meter_read`,`wm`.`last_kl` AS `last_kl`,`wm`.`prsnt_kl` AS `prsnt_klitres` from (`ownership` `os` join `watermeter` `wm` on((`os`.`idownership` = `wm`.`idownership`))) order by `wm`.`date_read` desc,`os`.`idflatno` */;

--
-- Final view structure for view `a_orginal2present_new`
--

/*!50001 DROP TABLE IF EXISTS `a_orginal2present_new`*/;
/*!50001 DROP VIEW IF EXISTS `a_orginal2present_new`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_orginal2present_new` AS select `fd`.`idflatno` AS `Flat_No`,`fd`.`datefreehold` AS `Freehold-Date`,`os1`.`idownership` AS `OOid`,`os1`.`membership_no` AS `OO_Membership`,concat(`od1`.`title`,_utf8' ',`od1`.`fullname`) AS `OO_Name`,`os2`.`idownership` AS `NMid`,`os2`.`membership_no` AS `NM_Membership`,concat(`od2`.`title`,_utf8' ',`od2`.`fullname`) AS `NO_Name` from ((((`flatdata` `fd` join `ownership` `os1` on((`fd`.`idflatno` = `os1`.`idflatno`))) left join `ownership` `os2` on((`fd`.`idflatno` = `os2`.`idflatno`))) join `ownerdata` `od1` on((`os1`.`idownership` = `od1`.`idownership`))) left join `ownerdata` `od2` on((`os2`.`idownership` = `od2`.`idownership`))) where ((`os1`.`idownership` <= 106) and (`os2`.`current_owner` = 1) and (`od1`.`jtownerorder` = 1) and (`od2`.`jtownerorder` = 1)) */;

--
-- Final view structure for view `b_leaseholdflats`
--

/*!50001 DROP TABLE IF EXISTS `b_leaseholdflats`*/;
/*!50001 DROP VIEW IF EXISTS `b_leaseholdflats`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `b_leaseholdflats` AS select distinct `fd`.`idflatno` AS `Flat_No`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners` from (`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) where ((`fd`.`isflatfreehold` = 0) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `a_current_members`
--

/*!50001 DROP TABLE IF EXISTS `a_current_members`*/;
/*!50001 DROP VIEW IF EXISTS `a_current_members`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_current_members` AS select `fd`.`idflatno` AS `Flat_No`,`fd`.`datefreehold` AS `Freehold_Date`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners`,concat(`od`.`title`,_utf8' ',`od`.`fullname`) AS `Name` from ((`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) join `ownerdata` `od` on((`os`.`idownership` = `od`.`idownership`))) where ((`os`.`is_member` = 1) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `a_presentflatowners`
--

/*!50001 DROP TABLE IF EXISTS `a_presentflatowners`*/;
/*!50001 DROP VIEW IF EXISTS `a_presentflatowners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_presentflatowners` AS select `fd1`.`idflatno` AS `Flat_No`,`fd1`.`datefreehold` AS `Freehold_Date`,`os1`.`membership_no` AS `Membership_No`,`os1`.`joint_owners` AS `Joint_Owners`,`os1`.`idownership` AS `idownership`,concat(`od1`.`title`,_utf8' ',`od1`.`fullname`) AS `Full_Name` from ((`flatdata` `fd1` join `ownership` `os1` on((`fd1`.`idflatno` = `os1`.`idflatno`))) join `ownerdata` `od1` on((`os1`.`idownership` = `od1`.`idownership`))) where (`os1`.`current_owner` = 1) */;

--
-- Final view structure for view `a_freehold_flatowners`
--

/*!50001 DROP TABLE IF EXISTS `a_freehold_flatowners`*/;
/*!50001 DROP VIEW IF EXISTS `a_freehold_flatowners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_freehold_flatowners` AS select `fd`.`idflatno` AS `Flat_No`,`fd`.`datefreehold` AS `Freehold_Date`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners`,`od`.`jtownerorder` AS `Ownership_Order`,concat(`od`.`title`,_utf8' ',`od`.`fullname`) AS `Full_Name` from ((`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) join `ownerdata` `od` on((`os`.`idownership` = `od`.`idownership`))) where ((`fd`.`isflatfreehold` = 1) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `lbvw_prsntowners`
--

/*!50001 DROP TABLE IF EXISTS `lbvw_prsntowners`*/;
/*!50001 DROP VIEW IF EXISTS `lbvw_prsntowners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `lbvw_prsntowners` AS select `ownership`.`idflatno` AS `idflatno`,`ownership`.`idownership` AS `idownership`,`ownership`.`current_owner` AS `current_owner` from `ownership` where (`ownership`.`current_owner` = 1) order by `ownership`.`idflatno` */;

--
-- Final view structure for view `b_freeholdflats`
--

/*!50001 DROP TABLE IF EXISTS `b_freeholdflats`*/;
/*!50001 DROP VIEW IF EXISTS `b_freeholdflats`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `b_freeholdflats` AS select `fd`.`idflatno` AS `idflatno`,`fd`.`datefreehold` AS `datefreehold`,`os`.`membership_no` AS `membership_no`,`os`.`joint_owners` AS `joint_owners` from (`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) where ((`fd`.`isflatfreehold` = 1) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `a_leasehold_flatowners`
--

/*!50001 DROP TABLE IF EXISTS `a_leasehold_flatowners`*/;
/*!50001 DROP VIEW IF EXISTS `a_leasehold_flatowners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_leasehold_flatowners` AS select distinct `fd`.`idflatno` AS `Flat_No`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners`,`od`.`jtownerorder` AS `Owner_Order`,concat(`od`.`title`,_utf8'',`od`.`fullname`) AS `Full_Name` from ((`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) join `ownerdata` `od` on((`os`.`idownership` = `od`.`idownership`))) where ((`fd`.`isflatfreehold` = 0) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `a_current_nonmembers`
--

/*!50001 DROP TABLE IF EXISTS `a_current_nonmembers`*/;
/*!50001 DROP VIEW IF EXISTS `a_current_nonmembers`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `a_current_nonmembers` AS select `fd`.`idflatno` AS `Flat_No`,`fd`.`datefreehold` AS `Freehold_Date`,`os`.`membership_no` AS `Membership_No`,`os`.`joint_owners` AS `Joint_Owners`,concat(`od`.`title`,_utf8' ',`od`.`fullname`) AS `Name` from ((`flatdata` `fd` join `ownership` `os` on((`fd`.`idflatno` = `os`.`idflatno`))) join `ownerdata` `od` on((`os`.`idownership` = `od`.`idownership`))) where ((`os`.`is_member` = 0) and (`os`.`current_owner` = 1)) */;

--
-- Final view structure for view `c_watermeter_view`
--

/*!50001 DROP TABLE IF EXISTS `c_watermeter_view`*/;
/*!50001 DROP VIEW IF EXISTS `c_watermeter_view`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `c_watermeter_view` AS select `watermeter`.`id_w_meter_read` AS `Id Read`,`watermeter`.`idownership` AS `Id Owner`,`watermeter`.`date_read` AS `Date Read`,`watermeter`.`last_kl` AS `Last KLit.`,`watermeter`.`prsnt_kl` AS `Now KLit.`,(`watermeter`.`prsnt_kl` - `watermeter`.`last_kl`) AS `Usage`,`watermeter`.`remarks` AS `Remarks`,`watermeter`.`if_billed` AS `If Billed` from `watermeter` order by `watermeter`.`date_read` desc */;

--
-- Final view structure for view `lbvw_elmeter`
--

/*!50001 DROP TABLE IF EXISTS `lbvw_elmeter`*/;
/*!50001 DROP VIEW IF EXISTS `lbvw_elmeter`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `lbvw_elmeter` AS select concat(`os`.`idflatno`,'  -  ',`em`.`date_read`) AS `Flat & Date Last Read`,`em`.`id_e_meter_read` AS `id_e_meter_read`,`em`.`last_kwh` AS `last_kwh`,`em`.`prsnt_kwh` AS `prsnt_kwh` from (`ownership` `os` join `electricmeter` `em` on((`os`.`idownership` = `em`.`idownership`))) order by `em`.`date_read` desc,`os`.`idflatno` */;

--
-- Final view structure for view `b_prsnt_frh_owners`
--

/*!50001 DROP TABLE IF EXISTS `b_prsnt_frh_owners`*/;
/*!50001 DROP VIEW IF EXISTS `b_prsnt_frh_owners`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `b_prsnt_frh_owners` AS select `fd1`.`idflatno` AS `Flat_No`,`fd1`.`isflatfreehold` AS `Freehold_Status`,`fd1`.`datefreehold` AS `Freehold_Date`,`os1`.`membership_no` AS `Membership_No`,`os1`.`joint_owners` AS `Joint_Owners`,`os1`.`idownership` AS `idownership`,concat(`od1`.`title`,_utf8' ',`od1`.`fullname`) AS `Full_Name` from ((`flatdata` `fd1` join `ownership` `os1` on((`fd1`.`idflatno` = `os1`.`idflatno`))) join `ownerdata` `od1` on((`os1`.`idownership` = `od1`.`idownership`))) where ((`os1`.`current_owner` = 1) and (`fd1`.`isflatfreehold` = 1)) */;

--
-- Final view structure for view `lbvw_flatnos`
--

/*!50001 DROP TABLE IF EXISTS `lbvw_flatnos`*/;
/*!50001 DROP VIEW IF EXISTS `lbvw_flatnos`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`Prakash`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `lbvw_flatnos` AS select `flatdata`.`idflatno` AS `idflatno` from `flatdata` */;


