If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Why won't this view update data?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-02-11, 23:51
regrahc regrahc is offline
Registered User
 
Join Date: Jun 2011
Posts: 3
Why won't this view update data?

Hello, and thanks in advance for any help. I created a view that I'd like to be able to update the underlying table with, and I'm not sure what this issue is. (I realize this is bad database design, it's necessary for what I'm trying to do)

The underlying table:
CREATE TABLE `expireds` (
`ID` int(11) NOT NULL auto_increment,
`First_Owner_First_Name` varchar(20) default '0',
`First_Owner_Last_Name` varchar(20) default '0',
`Second_Owner_First_Name` varchar(20) default '0',
`Second_Owner_Last_Name` varchar(20) default '0',
`MLS#` varchar(10) default '0',
`Status` varchar(10) default '0',
`OMD` date default NULL,
`FollowUpDate` date default NULL,
`date_last_checked` date default NULL,
`Site_Address` varchar(30) NOT NULL default '0',
`Site_Unit` varchar(10) default '0',
`Site_City` varchar(20) default '0',
`Site_State` varchar(2) default '0',
`Site_Zip` varchar(6) default '0',
`Mail_Address` varchar(30) default '0',
`Mail_Unit` varchar(10) default '0',
`Mail_City` varchar(20) default '0',
`Mail_State` varchar(2) default '0',
`Mail_Zip` varchar(6) default '0',
`Parcel_Number` varchar(20) default '0',
`Comments` varchar(9999) default '0',
`Met` tinyint(1) default '0',
`MetDate` date default NULL,
`Phone1` varchar(15) default '0',
`Phone2` varchar(15) default '0',
`Phone3` varchar(15) default '0',
`Phone4` varchar(15) default '0',
`Phone5` varchar(15) default '0',
`Phone6` varchar(15) default '0',
`Phone7` varchar(15) default '0',
`Phone8` varchar(15) default '0',
`Phone9` varchar(15) default '0',
`Phone10` varchar(15) default '0',
`Phone11` varchar(15) default '0',
`Phone12` varchar(15) default '0',
`Phone13` varchar(15) default '0',
`Phone14` varchar(15) default '0',
`Phone15` varchar(15) default '0',
`DNC` tinyint(1) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Site_Address` (`Site_Address`),
UNIQUE KEY `Site_Address_2` (`Site_Address`),
UNIQUE KEY `Site_Address_3` (`Site_Address`),
UNIQUE KEY `Site_Address_4` (`Site_Address`),
UNIQUE KEY `Site_Address_5` (`Site_Address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


And the view:

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `expireds_view` AS
select
`expireds`.`First_Owner_First_Name` AS `First_Owner_First_Name`,
`expireds`.`First_Owner_Last_Name` AS `First_Owner_Last_Name`,
`expireds`.`Second_Owner_First_Name` AS `Second_Owner_First_Name`,
`expireds`.`Second_Owner_Last_Name` AS `Second_Owner_Last_Name`,
`expireds`.`MLS#` AS `MLS#`,
`expireds`.`Status` AS `Status`,
`expireds`.`OMD` AS `OMD`,
`expireds`.`FollowUpDate` AS `FollowUpDate`,
`expireds`.`Site_Address` AS `Site_Address`,
`expireds`.`Site_City` AS `Site_City`,
`expireds`.`Site_State` AS `Site_State`,
`expireds`.`Site_Zip` AS `Site_Zip`,
`expireds`.`Comments` AS `Comments`,
`expireds`.`Met` AS `Met`,
`expireds`.`Phone1` AS `Phone1`,
`expireds`.`Phone2` AS `Phone2`,
`expireds`.`Phone3` AS `Phone3`,
`expireds`.`Phone4` AS `Phone4`,
`expireds`.`Phone5` AS `Phone5`,
`expireds`.`Phone6` AS `Phone6`,
`expireds`.`Phone7` AS `Phone7`,
`expireds`.`Phone8` AS `Phone8`,
`expireds`.`Phone9` AS `Phone9`,
`expireds`.`Phone10` AS `Phone10`,
`expireds`.`Phone11` AS `Phone11`,
`expireds`.`Phone12` AS `Phone12`,
`expireds`.`Phone13` AS `Phone13`,
`expireds`.`Phone14` AS `Phone14`,
`expireds`.`Phone15` AS `Phone15`
from
`expireds`
where
((_latin1'Met' = 0) or (_latin1'FollowUpDate' = curdate()));

I tried changing out all the NULL fields to default to 0's (read that view can't contain fields w/o default values), same result. Went over the requirements for creating an updatable view in the documentation, and I don't see an issue. What am I missing?

Thanks again!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On