<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>MySQL Forums - Views</title>
        <description>Forum for MySQL Views</description>
        <link>http://forums.mysql.com/list.php?100</link>
        <lastBuildDate>Fri, 24 May 2013 20:58:52 +0000</lastBuildDate>
        <generator>Phorum 5.2.19</generator>
        <item>
            <guid>http://forums.mysql.com/read.php?100,587209,587209#msg-587209</guid>
            <title>北京天安中医院 (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,587209,587209#msg-587209</link>
            <description><![CDATA[ &lt;a href=&quot;<a href="http://mqysh.net/&quot;&gt"  rel="nofollow">http://mqysh.net/&quot;&gt</a>;北京天安中医院&lt;/a&gt;<a href="http://mqysh.net/"  rel="nofollow">http://mqysh.net/</a><br />
&lt;a href=&quot;<a href="http://mqysh.net/&quot;&gt"  rel="nofollow">http://mqysh.net/&quot;&gt</a>;北京耳鼻喉医院&lt;/a&gt;<a href="http://mqysh.net/"  rel="nofollow">http://mqysh.net/</a><br />
&lt;a href=&quot;<a href="http://mqysh.net/&quot;&gt"  rel="nofollow">http://mqysh.net/&quot;&gt</a>;北京五官科医院&lt;/a&gt;<a href="http://mqysh.net/"  rel="nofollow">http://mqysh.net/</a><br />
&lt;a href=&quot;<a href="http://mqysh.net/&quot;&gt"  rel="nofollow">http://mqysh.net/&quot;&gt</a>;北京耳鼻喉医院哪家好&lt;/a&gt;<a href="http://mqysh.net/"  rel="nofollow">http://mqysh.net/</a><br />
<br />
<br />
&lt;a href=&quot;<a href="http://www.taebh.com/&quot;&gt"  rel="nofollow">http://www.taebh.com/&quot;&gt</a>;北京耳鼻喉医院&lt;/a&gt;<a href="http://www.taebh.com/"  rel="nofollow">http://www.taebh.com/</a><br />
&lt;a href=&quot;<a href="http://www.taebh.com/&quot;&gt"  rel="nofollow">http://www.taebh.com/&quot;&gt</a>;北京耳鼻喉专科医院&lt;/a&gt;<a href="http://www.taebh.com/"  rel="nofollow">http://www.taebh.com/</a><br />
&lt;a href=&quot;<a href="http://www.taebh.com/&quot;&gt"  rel="nofollow">http://www.taebh.com/&quot;&gt</a>;北京耳鼻喉医院排名&lt;/a&gt;<a href="http://www.taebh.com/"  rel="nofollow">http://www.taebh.com/</a><br />
&lt;a href=&quot;<a href="http://www.taebh.com/&quot;&gt"  rel="nofollow">http://www.taebh.com/&quot;&gt</a>;北京天安中医院&lt;/a&gt;<a href="http://www.taebh.com/"  rel="nofollow">http://www.taebh.com/</a><br />
<br />
<a href="http://mqysh.net/"  rel="nofollow">http://mqysh.net/</a><br />
<a href="http://www.taebh.com/"  rel="nofollow">http://www.taebh.com/</a>]]></description>
            <dc:creator>baoshanli 丹尼</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 24 May 2013 05:46:44 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,584912,584912#msg-584912</guid>
            <title>Query not returning what I expect (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,584912,584912#msg-584912</link>
            <description><![CDATA[ I'm not sure why I'm having a brain freeze today, but I've gone in circles long enough, so I'm here for some sanity.<br />
<br />
For background purposes. There are 17 questions in this table:<br />
CREATE TABLE `question` (<br />
  `ID` tinyint(4) unsigned NOT NULL AUTO_INCREMENT,<br />
  `Question` varchar(50) NOT NULL,<br />
  PRIMARY KEY (`ID`)<br />
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8$$<br />
<br />
<br />
The real work is done here:<br />
CREATE TABLE `client-question` (<br />
  `ID` int(11) NOT NULL AUTO_INCREMENT,<br />
  `ClientID` int(11) NOT NULL,<br />
  `QuestionID` tinyint(4) unsigned NOT NULL,<br />
  `UserID` int(11) DEFAULT NULL,<br />
  `Value` tinyint(3) unsigned DEFAULT NULL,<br />
  `Timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,<br />
  PRIMARY KEY (`ID`),<br />
  KEY `ClientID` (`ClientID`),<br />
  KEY `QuestionID` (`QuestionID`),<br />
  KEY `UserID` (`UserID`)<br />
) ENGINE=MyISAM AUTO_INCREMENT=18115 DEFAULT CHARSET=utf8$$<br />
<br />
I have another (insignificant for this post) table that has 1000 Clients, and another table that has 5 users.  Each of the 5 user needs to answer the 17 questions for each of the 1000 clients.  By default I have populated the client-question table with the necessary records (5x17x1000 rows).  Value is null and Timestamp is null so that each user can see on their screen that they need to answer that question.<br />
<br />
<br />
Here comes the tricky part.  If it's a new record then the Value gets filled in with whatever they choose from the dropdown (1-5 from a combobox) .  If there is already a Value then it creates a new record (so I can keep track of history as the user changes their mind about this client).  The form needs to display always the most current Value entered for that client and user.  It also needs to display all 17 questions.<br />
<br />
Scenario:<br />
UserID 1 is on the screen of ClientID 1.  They have already answered QuestionID 1 five times, but the other 16 question have never been answered, so the 16 pre-populated Value and Timestamp records are null.<br />
<br />
I need a query to return the 16 null questions and the most recent Value of the one answered question.  I'm thinking something like this, but it doesn't work!<br />
<br />
SELECT <br />
    MAX(ID),<br />
    ClientID,<br />
    QuestionID,<br />
    UserID,<br />
    `Value`,<br />
    `Timestamp`<br />
FROM<br />
    `client-question`<br />
WHERE UserID=1 OR UserID IS NULL<br />
GROUP BY ClientID, QuestionID, UserID<br />
HAVING ClientID = 1<br />
<br />
It successfully returns the 16 questions that haven't been answered by anybody yet; it returns the 1 question that HAS been answered by UserID 1, and it even returns the correct row ID; however, it returns a Value and Timestamp from the first row, not the Value and Timestamp from the row that it should be (in this case the ID of the MAX(ID) is 18114, but the Value and Timestamp for the returned data is from ID 884).  Ideally, in Access, I would use LAST(Value), LAST(Timestamp) but it doesn't return as expected.<br />
<br />
Any ideas?]]></description>
            <dc:creator>Bodi K</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 26 Apr 2013 17:42:05 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,583765,583765#msg-583765</guid>
            <title>SQL Server (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,583765,583765#msg-583765</link>
            <description><![CDATA[ How to recover corrupt MDF file from SQL database?]]></description>
            <dc:creator>Jamie Paul</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 12 Apr 2013 16:22:30 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,583729,583729#msg-583729</guid>
            <title>Join (7 replies)</title>
            <link>http://forums.mysql.com/read.php?100,583729,583729#msg-583729</link>
            <description><![CDATA[ I have 2 tables, stockOptions and stockOptionTrades. In general, for each stockOption there are many stockOptionTrades'.<br />
<br />
1) select count(*) from todaysStockOptions; returns 147774 in .125 seconds.<br />
2) select count(*) from todaysStockOptionTrades; returns 78538 in 0.140 seconds.<br />
<br />
but <br />
<br />
3) select count(*) from todaysStockOptionTrades join todaysStockOptions using (optionSymbol); returns 78538 in 86 seconds!<br />
<br />
Simple question: Why does the joined query take so much longer? Both tables are indexed on optionSymbol. What can I do to speed this up?<br />
<br />
Thanks<br />
Austin]]></description>
            <dc:creator>Austin Kalb</dc:creator>
            <category>Views</category>
            <pubDate>Mon, 15 Apr 2013 21:29:09 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,579349,579349#msg-579349</guid>
            <title>I can access views on ONE server but not on another one (4 replies)</title>
            <link>http://forums.mysql.com/read.php?100,579349,579349#msg-579349</link>
            <description><![CDATA[ Hello,<br />
My problem is as follows:<br />
The same view (combining more than one table) is defined on a particular mysql-server. SHOW GRANTS FOR userid shows:<br />
(1) on Server1 (MySQL V 5.5.28-1-log (Debian-Wheezy), connected to the client through local lan, same network):<br />
GRANT USAGE ON *.* TO 'userid'@'%' . <br />
I can query the view as expected.<br />
(2) on Server2 (MySQL V 5.1.66-0+squeeze1-log (Debian-Squeeze), connected to the client through the Internet:<br />
GRANT ALL PRIVILEGES ON *.* TO 'userid'@'%' IDENTIFIED BY PASSWORD '***********' WITH GRANT OPTION;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON 'dbname'.* TO 'userid'@'%';<br />
GRANT SELECT ON 'dbname'.'viewViewName' TO 'userid'@'%'; <br />
Whenever I query the view on THIS server I get an empty set of replies.<br />
Any ideas about what I do wrong?<br />
Thanks a lot for any hints<br />
H. Stoellinger]]></description>
            <dc:creator>Heinz Stoellinger</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 21 Feb 2013 22:47:16 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,577646,577646#msg-577646</guid>
            <title>Any way to optimize view (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,577646,577646#msg-577646</link>
            <description><![CDATA[ Views are really great however there are somecase where I find them very non performant and was wonderning if there was a way to cope with this.<br />
<br />
Let's say I have a view which is a UNION of 3 select queries with INER JOINs and which look alike but do not work on the same tables.<br />
<br />
Running explain on each and every of the 3 select with a WHERE clause containing<br />
item.name like '%pattern%' shows perfect usage of indexes and each select return in<br />
less than 1/10th of a second<br />
<br />
However the view is defined with<br />
CREATE VIEW MyInfos AS<br />
select item.name .......<br />
from ..... innner join .....<br />
union<br />
select item.name ......<br />
from ..... innner join .....<br />
union<br />
select item.name ......<br />
from ..... innner join .....<br />
<br />
and of course running<br />
select * from MyInfos where item.name like '%pattern%'<br />
takes around 15s because the item.name like '%pattern%'<br />
can not be used with each select to make proper uses of indexes<br />
<br />
Is there a way to solve this or should I mode to procedure instead of view for this<br />
very particular case ?]]></description>
            <dc:creator>Olivier Bourdon</dc:creator>
            <category>Views</category>
            <pubDate>Mon, 21 Jan 2013 14:55:28 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,577370,577370#msg-577370</guid>
            <title>View problems when updating to 5.5 from 5.1 (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,577370,577370#msg-577370</link>
            <description><![CDATA[ This may be too advanced for the Newbie forum, but I cannot work out just where it should go.<br />
<br />
I just upgraded to version MySQL 5.5 from 5.1. My website uses a view for all its operations in some 80 files. There are 8 files, all linked into this view, which was originally generated by Microsoft Access and moved across into MySQL.<br />
<br />
When I look at the view table (and only the view table), I get a message just under the Browse button that reads &quot;#1449 - The user specified as a definer (username@'192.168.0.%) does not exist&quot; The correct username is installed in the user tables, and has full rights as far as I can see, as he is a copy of the root user with a different password. He can access all parts of the system and should be able to do anything (including GRANT). He is the same username and has the same password as the original one, though I believe that version 5.5 uses a different hashing algorythm for passwords.<br />
<br />
The database has been exported and imported from 5.1 database into a 5.5.25 database. I have searched chapter 19 on Views, but am sorry to say that it makes little sense at all, and does not seem to cover any changes that may be required due to the update from 5.1. It mentions &quot;definer&quot; in many paragraphs, but does not state how to change or create a definer. The use of a definer  was never mentioned in 5.1, or if it was I have never come across it in the 11 years or so that my website has been running, in various versions of MySQL from 4 upwards.<br />
The same problem happens when anyone attempts to access the website, which uses the same username/password combination as the control panel.<br />
So how do I fix this problem?<br />
Maybe you have come across it.]]></description>
            <dc:creator>Howard Walker</dc:creator>
            <category>Views</category>
            <pubDate>Tue, 15 Jan 2013 17:34:10 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,577171,577171#msg-577171</guid>
            <title>Join with a View (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,577171,577171#msg-577171</link>
            <description><![CDATA[ Using 5.5 I created a View with WorkBench:<br />
USE `rxcds_db`;<br />
CREATE  OR REPLACE VIEW `rxcds_db`.`ViewRenalData` AS<br />
SELECT Patient.Acct, Patient.LastName, Patient.FirstName, Patient.Loc, Patient.Age, Patient.Sex, Patient.Ht, Patient.Wt, Lab.LabID, Lab.CreatTime, Lab.Creat, <br />
                      Lab.BUNTime, Lab.BUN<br />
FROM  (Lab INNER JOIN<br />
                      Patient ON Patient.Acct = Lab.Acct);<br />
<br />
The SELECT .... returns a table of data fine, but if I <br />
&quot;select * from ViewRenalData;&quot; the returned table has no data.<br />
<br />
I also note that in WorkBench the ViewRenalData displays as a View in Model Overview, but is listed as a Table in the Object Browser of the Sql Editor.<br />
<br />
Please advise.  Why doesn't &quot;select * from ViewRenalData&quot; return data ?]]></description>
            <dc:creator>Albert Stewart</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 10 Jan 2013 20:33:22 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,577092,577092#msg-577092</guid>
            <title>VIEW crashing MySQL... (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,577092,577092#msg-577092</link>
            <description><![CDATA[ Hi everybody,<br />
<br />
I don't frequently use views in MySQL, but a customer tried the following :<br />
- create a table with a &quot;text&quot; column containing 2 digits integers,<br />
- select avg on this field : OK<br />
- create a view with this select : crash MySQL???<br />
- the same view with a round(avg()) behaves correctly.<br />
<br />
Crash occurs on genuine CentOS 6.3 32 bits updated :<br />
LSB Version:	:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch<br />
Distributor ID:	CentOS<br />
Description:	CentOS release 6.3 (Final)<br />
Release:	6.3<br />
Codename:	Final<br />
mysql-5.1.66-2.el6_3.i686<br />
mysql-connector-odbc-5.1.5r1144-7.el6.i686<br />
mysql-libs-5.1.66-2.el6_3.i686<br />
MySQL-python-1.2.3-0.3.c1.1.el6.i686<br />
mysql-server-5.1.66-2.el6_3.i686<br />
perl-DBD-MySQL-4.013-3.el6.i686<br />
php-mysql-5.3.3-14.el6_3.i686<br />
<br />
The same view on <br />
LSB Version:	:core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch<br />
Distributor ID:	CentOS<br />
Description:	CentOS release 5.8 (Final)<br />
Release:	5.8<br />
Codename:	Final<br />
mysql-5.0.95-1.el5_7.1<br />
mysql-devel-5.0.95-1.el5_7.1<br />
mysql-server-5.0.95-1.el5_7.1<br />
perl-DBD-MySQL-3.0007-2.el5<br />
php-mysql-5.1.6-39.el5_8<br />
<br />
behaves as expected.<br />
<br />
An export of the database :<br />
test.sql<br />
-- phpMyAdmin SQL Dump<br />
-- version 3.5.4<br />
-- <a href="http://www.phpmyadmin.net"  rel="nofollow">http://www.phpmyadmin.net</a><br />
--<br />
-- Client: localhost<br />
-- Généré le: Mer 09 Janvier 2013 à 08:28<br />
-- Version du serveur: 5.1.66<br />
-- Version de PHP: 5.3.3<br />
<br />
SET SQL_MODE=&quot;NO_AUTO_VALUE_ON_ZERO&quot;;<br />
SET time_zone = &quot;+00:00&quot;;<br />
<br />
<br />
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;<br />
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;<br />
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;<br />
/*!40101 SET NAMES utf8 */;<br />
<br />
--<br />
-- Base de données: `test`<br />
--<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Doublure de structure pour la vue `avg`<br />
--<br />
DROP VIEW IF EXISTS `avg`;<br />
CREATE TABLE IF NOT EXISTS `avg` (<br />
`Moyenne` double<br />
);<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Doublure de structure pour la vue `round_avg`<br />
--<br />
DROP VIEW IF EXISTS `round_avg`;<br />
CREATE TABLE IF NOT EXISTS `round_avg` (<br />
`Moyenne` double(17,0)<br />
);<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Structure de la table `t_tir`<br />
--<br />
<br />
DROP TABLE IF EXISTS `t_tir`;<br />
CREATE TABLE IF NOT EXISTS `t_tir` (<br />
  `id` int(11) NOT NULL AUTO_INCREMENT,<br />
  `score` text,<br />
  PRIMARY KEY (`id`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;<br />
<br />
--<br />
-- Contenu de la table `t_tir`<br />
--<br />
<br />
INSERT INTO `t_tir` (`id`, `score`) VALUES<br />
(1, '87'),<br />
(2, '93'),<br />
(3, '90'),<br />
(4, '83'),<br />
(5, '90'),<br />
(6, '83'),<br />
(7, '80'),<br />
(8, '77'),<br />
(9, '73'),<br />
(10, '87'),<br />
(11, '83'),<br />
(12, '73'),<br />
(13, '93'),<br />
(14, '87'),<br />
(15, '77'),<br />
(16, '80'),<br />
(17, '73'),<br />
(18, '93'),<br />
(19, '80'),<br />
(20, '93'),<br />
(21, '93'),<br />
(22, '83'),<br />
(24, '83'),<br />
(25, '77');<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Structure de la vue `avg`<br />
--<br />
DROP TABLE IF EXISTS `avg`;<br />
<br />
CREATE ALGORITHM=UNDEFINED DEFINER=`test`@`localhost` SQL SECURITY DEFINER VIEW `avg` AS select avg(`t_tir`.`score`) AS `Moyenne` from `t_tir`;<br />
<br />
-- --------------------------------------------------------<br />
<br />
--<br />
-- Structure de la vue `round_avg`<br />
--<br />
DROP TABLE IF EXISTS `round_avg`;<br />
<br />
CREATE ALGORITHM=UNDEFINED DEFINER=`test`@`localhost` SQL SECURITY DEFINER VIEW `round_avg` AS select round(avg(`t_tir`.`score`),0) AS `Moyenne` from `t_tir`;<br />
<br />
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;<br />
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;<br />
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;<br />
<br />
<br />
Any idea??<br />
<br />
  Thanks,<br />
<br />
    Christophe.]]></description>
            <dc:creator>Christophe NOUVEL</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 09 Jan 2013 07:54:43 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,576104,576104#msg-576104</guid>
            <title>Crown Capital Eco Management-Zimbio (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,576104,576104#msg-576104</link>
            <description><![CDATA[ Crown Capital Eco Management works with government bodies, international entities, private sectors and other non-governmental organizations in providing extensive information to the public, media and policymakers that are involved in addressing environmental issues and sustainable initiatives in a worldwide scale. Though our group does not personally conduct research, we analyze and review both recent and old data on technical and socio-economic sectors that are relevant to our field, which is environment preservation.<br />
We all know that regardless of where you live, the weather is often unpredictable. A comfy 60 degree winter day in the Midwest; chilly and breezy on a late spring day in the pacific coast. To some of us, the prevalence of unusual weather is simply the work of Mother Nature.<br />
<br />
Reviews<br />
<br />
Northern Europe picks on the Atlantic Ocean because of its wet summer according to a new study. The rising and falling of ocean temperature or the so called cyclical deception is seen as a major extortion on the weather. The said pattern reported will last long as the Atlantic warming persists. The research was carried out at the University of Reading and is published in the journal Nature <br />
Geoscience.<br />
The heavily forested city of Ketchikan, Alaska, is built on rock and surrounded by water. Every commodity that comes into Ketchikan must arrive by sea or air. The use of fuel oil is problematic for both economic and environmental reasons because the oil must be obtained and refined elsewhere and transported (using additional fuel). What's more, fuel oil is subject to price instability.]]></description>
            <dc:creator>Macki Andrews</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 14 Dec 2012 05:47:59 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,576014,576014#msg-576014</guid>
            <title>Is MySQL suitable for software management? (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,576014,576014#msg-576014</link>
            <description><![CDATA[ If we use blogs or CMS softwares like wordpress and drupal, we have to place the website on a web host that provides a MySQL database. The database can be used by any software (for ex: educational software,MLM software, computer software) to store articles, web pages as well as comment's made by the visitors.<br />
<br />
Refernce <a href="http://infinitemlmsoftware.com"  rel="nofollow">http://infinitemlmsoftware.com</a>]]></description>
            <dc:creator>Prasoon Prahaladan</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 13 Dec 2012 11:46:05 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,575991,575991#msg-575991</guid>
            <title>Brightbridge Wealth Management-Windows messenger live to close-Rediffpages (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,575991,575991#msg-575991</link>
            <description><![CDATA[ Microsoft has announced it intends to “retire” its instant message chat tool and replace it with Skype’s messaging tool. The news comes 18 months after the software giant announced it was paying $8.5bn (£5.3bn) for the communications software developer. Brightbridgewealth-management report, Microsoft said Windows Live Messenger (WLM) would be turned off by March 2013 worldwide, with the exception of China. It reflects the firm’s determination to focus its efforts on Skype.<br />
WLM launched in 1999 when it was known as MSN Messenger. Over time, photo delivery, video calls and games were added to the package’s text-based messages. According to internet analysis firm Comscore-Brightbridgewealth-management, WLM still had more than double the number of Skype’s instant messenger facility at the start of this year and was second only in popularity to Yahoo Messenger.<br />
But the Brigthbridge report suggested WLM’s US audience had fallen to 8.3 million unique users, representing a 48% drop year-on-year. By contrast, the number of people using Skype to instant message each other grew over the period.<br />
“When a company has competing products that can result in cannibalization it’s often better to focus on a single one,” said Brian Blau from the consultancy Gartner.<br />
“Skype’s top-up services offer the chance to monetize its users and Microsoft is also looking towards opportunities in the living room.<br />
“Messenger doesn’t seem like an appropriate communications platform for TVs or the firm’s Xbox console – but Skype does.”<br />
He also noted that the firm had opted to integrate Skype into its new Windows Phone 8 smartphone software, eclipsing the effort to integrate WLM into the message threads of the operating system’ previous version. To ease the changeover, Microsoft is offering a tool to migrate WLM messenger contacts over. The risk is that the move encourages users to switch instead to rival platforms such as WhatsApp Messenger, AIM or Google Talk. But Microsoft is at least partially protected by its tie-up with Facebook last year. Skype video calls are now offered as an extra to the social network’s own instant messaging tool.]]></description>
            <dc:creator>Maxx Webber</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 13 Dec 2012 07:28:40 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,574278,574278#msg-574278</guid>
            <title>Views - Affected by 'root' accounts? (2 replies)</title>
            <link>http://forums.mysql.com/read.php?100,574278,574278#msg-574278</link>
            <description><![CDATA[ Hi all,<br />
<br />
My first post, so i'll try and be as clear as possible.<br />
<br />
I hope someone can shed some light on this for me.<br />
<br />
I've set up some views on my MySQL Database to make the syntax a little clearer when running through php.<br />
<br />
My user setup to start with was basically:<br />
<br />
User - Host<br />
============<br />
root - localhost<br />
root - %<br />
user1 - %<br />
user2 - %<br />
user2 - %<br />
<br />
Which worked fine.  However:<br />
<br />
When checking the logs today i was concerned to see  a load of failed attempts from around the world (China most of them) so decided to restrict the root@% to a specific location.<br />
<br />
So, the user setup changed to:<br />
<br />
User - Host<br />
============<br />
root - localhost<br />
root - domain.com<br />
user1 - %<br />
user2 - %<br />
user2 - %<br />
<br />
But now, if i log in as any of the user accounts i cannot access anything that uses a view, general SELECT statements work fine however.<br />
<br />
I just can't understand what's going on, there's nothing in the php connect strings that refer to a root account so i'm finding it hard to understand how this can affect things.<br />
<br />
Would appreciate any help on this.<br />
<br />
For reference MySQL is running on a windows 2008 server and the connections are being made off-site.<br />
<br />
Thanks.]]></description>
            <dc:creator>Leon Seaman</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 28 Nov 2012 13:07:43 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,570245,570245#msg-570245</guid>
            <title>Simple But Not So Simple (2 replies)</title>
            <link>http://forums.mysql.com/read.php?100,570245,570245#msg-570245</link>
            <description><![CDATA[ Hi All,<br />
<br />
I have the following table structure machine_statuses:<br />
<br />
p_id  machine_id   machine_status    status_date<br />
<br />
1      100         start             2012/10/05 90:00:00<br />
2      101         start             2012/10/05 90:00:01<br />
3      101         moving            2012/10/05 90:00:02<br />
4      102         start             2012/10/05 90:00:03<br />
<br />
<br />
I want to group the above table by machine_id and have only the LASTEST status as entered in status_date.  Hence, I am doin the following SQLs, but it is not working: <br />
<br />
select p_id, machine_id, machine_status, MAX(status_date) from machine_statuses<br />
group by machine_id<br />
<br />
or<br />
<br />
select p_id, machine_id, machine_status, status_date from machine_statuses<br />
group by machine_id<br />
order by MAX(status_date)<br />
<br />
or<br />
<br />
select p_id, machine_id, machine_status, status_date from machine_statuses<br />
group by machine_id<br />
order by MAX(p_id)<br />
<br />
...but I am getting incorrect results, like:<br />
<br />
1      100         start             2012/10/05 90:00:00<br />
2      101         start             2012/10/05 90:00:02<br />
4      102         start             2012/10/05 90:00:03<br />
<br />
or<br />
<br />
1      100         start             2012/10/05 90:00:00<br />
2      101         start             2012/10/05 90:00:01<br />
4      102         start             2012/10/05 90:00:03<br />
<br />
<br />
...when I would like the following: <br />
<br />
1      100         start             2012/10/05 90:00:00<br />
3      101         moving            2012/10/05 90:00:02<br />
4      102         start             2012/10/05 90:00:03<br />
<br />
<br />
...I would be most appreciative if anyone could help me solve this challenging scenario.<br />
<br />
Many thanks,<br />
Jamie B]]></description>
            <dc:creator>Jamie B</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 23 Nov 2012 02:15:35 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,570202,570202#msg-570202</guid>
            <title>Strange Outcome (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,570202,570202#msg-570202</link>
            <description><![CDATA[ Hi All, <br />
<br />
I have a very strange results when running the following query using MySQL 5.1.65 Community:  <br />
<br />
select sess.session_id, auser.user_id, user_asset.entity_id, ast.asset_id, a_status.asset_state <br />
<br />
FROM `session` AS sess<br />
<br />
LEFT JOIN `app_user` AS auser ON (sess.user_id=auser.user_id)<br />
<br />
LEFT JOIN `group_entity_list` AS user_asset ON (auser.group_id=user_asset.group_id AND user_asset.entity_type = 'asset')  <br />
<br />
LEFT JOIN `asset` AS ast ON (user_asset.entity_id=ast.asset_id)<br />
<br />
LEFT JOIN `asset_status` AS a_status ON (a_status.asset_id=ast.asset_id) <br />
 <br />
group by a_status.asset_id <br />
<br />
order by MAX(a_status.last_updt_drvtime)<br />
<br />
...from the above query I was hoping to get only the lastest asset statuses as I have used the MAX function of the DATETIME field for last update.<br />
<br />
I could probably solve this problem by doing a nested query, but I believe that is not the best way forward.<br />
<br />
Anyone have any ideas on how to solve this seemly simple problem, but in reality it is much more complex???<br />
<br />
For example (in short may not reflect the column names above), if I have the following subset table data:<br />
<br />
1 (status_asset_id), started (status_stage), 2012/10/04 09:00:01 (datetime)<br />
1 (status_asset_id), moving (status_stage), 2012/10/04 09:00:02 (datetime)<br />
2 (status_asset_id), starting (status_stage), 2012/10/04 09:00:03 (datetime)<br />
3 (status_asset_id), starting (status_stage), 2012/10/04 09:00:04 (datetime)<br />
<br />
The expected output should be:<br />
<br />
1 (status_asset_id), moving (status_stage), 2012/10/04 09:00:02 (datetime)<br />
2 (status_asset_id), starting (status_stage), 2012/10/04 09:00:03 (datetime)<br />
3 (status_asset_id), starting (status_stage), 2012/10/04 09:00:04 (datetime)<br />
<br />
...that is, status_asset_id with value 1, should have the moving state listed, but in reality, I am getting: <br />
<br />
1 (status_asset_id), started (status_stage), 2012/10/04 09:00:01 (datetime)<br />
2 (status_asset_id), starting (status_stage), 2012/10/04 09:00:03 (datetime)<br />
3 (status_asset_id), starting (status_stage), 2012/10/04 09:00:04 (datetime)<br />
<br />
<br />
Many thank...]]></description>
            <dc:creator>Jamie B</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 04 Oct 2012 17:59:46 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,570160,570160#msg-570160</guid>
            <title>Use xml data as view column in Mysql (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,570160,570160#msg-570160</link>
            <description><![CDATA[ hi all,<br />
In MSSQL code, it's easy to collect data in xml format as a column when create a view.<br />
In mysql, kind of like this:<br />
<br />
CREATE VIEW myview<br />
AS<br />
SELECT event.End_date as date, (SELECT people.Last_name from people INNER JOIN  ... WHERE ... FOR XML PATH('') )as person, <br />
FROM  event <br />
INNER JOIN ...<br />
WHERE ...<br />
<br />
Where &quot;FOR XML PATH('')&quot; comes from MSSQL. From my understanding, it will format the subquery results as xml, and then this xml data will be used as a colum in view. Because this subquery will return many rows (This makes sense why this subquery uses xml format to collect data), if we ingore this xml code, there'll be problems im mysql, saying the subquery has more than one rows.<br />
On the other hand,<br />
When SELECT event.End_date as date returns one row, the subquery will return more than one rows.<br />
<br />
According to <a href="http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html"  rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html</a>, is this the only handy way to get xml output in Mysql? I mean 'It is possible to obtain XML-formatted output from MySQL in the mysql and mysqldump clients by invoking them with the --xml option'.<br />
<br />
According to <a href="http://web.archive.org/web/20100212101622/http://dev.mysql.com/tech-resources/articles/xml-in-mysql5.1-6.0.html"  rel="nofollow">http://web.archive.org/web/20100212101622/http://dev.mysql.com/tech-resources/articles/xml-in-mysql5.1-6.0.html</a> it's complicated to get xml data.<br />
<br />
Is there any xml solution for view in Mysql? Thank you.]]></description>
            <dc:creator>Rulin Tang</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 04 Oct 2012 09:37:35 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,569193,569193#msg-569193</guid>
            <title>Creating view for sales data analysis (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,569193,569193#msg-569193</link>
            <description><![CDATA[ Hi - <br />
<br />
I have 3 tables: customers, suppliers, and invoices, from which I need to create some sales history reports with invoice amount sums for various date ranges, corresponding to each customer-supplier pairing:<br />
<br />
- currmon<br />
- prevmtd (from first to today for this month last year)<br />
- curryr<br />
- prevytd (from first day of last year up to today)<br />
- prevyr (all of last year)<br />
<br />
and 2 more columns:<br />
<br />
- lastinvoice (date of most recent invoice for this customer-supplier pairing)<br />
- pctdiffytd (percent *change* in total amount between prevytd and curryr)<br />
<br />
I created a set of simple views for each of the amount sum columns and am attempting to combine them into one result set.  The result should have *at most* one row for each customer-supplier pairing (some customers may not have bought from all suppliers).<br />
<br />
My result has way too many records, 1216 total, with only 6 customers and 3 suppliers in my sample data.  here is the SQL I am using (FYI, this application is being migrated from MS Access):<br />
<br />
CREATE ALGORITHM=UNDEFINED DEFINER=`evsalestool`@`%` SQL SECURITY DEFINER VIEW `customer_sales`<br />
AS select<br />
   `suppliers`.`name` AS `supplier`,<br />
   `suppliers`.`id` AS `sid`,<br />
   `customer_sales_currmon`.`currmon` AS `currmon`,<br />
   `customer_sales_prevmtd`.`prevmtd` AS `prevmtd`,<br />
   `customer_sales_curryr`.`curryr` AS `curryr`,<br />
   `customer_sales_prevytd`.`prevytd` AS `prevytd`,<br />
   `customer_sales_prevyr`.`prevyr` AS `prevyr`,max(`invoices`.`date`) AS `lastinvoice`,<br />
   `invoices`.`customer` AS `customer`<br />
from ((((((`suppliers` join `invoices` on((`suppliers`.`id` = `invoices`.`supplier`))) left join `customer_sales_prevytd` on((`suppliers`.`id` = `customer_sales_prevytd`.`supplier`))) left join `customer_sales_currmon` on((`suppliers`.`id` = `customer_sales_currmon`.`supplier`))) left join `customer_sales_prevmtd` on((`suppliers`.`id` = `customer_sales_prevmtd`.`supplier`))) left join `customer_sales_prevyr` on((`suppliers`.`id` = `customer_sales_prevyr`.`supplier`))) left join `customer_sales_curryr` on((`suppliers`.`id` = `customer_sales_curryr`.`supplier`))) group by `suppliers`.`name`,`suppliers`.`id`,`customer_sales_currmon`.`currmon`,`customer_sales_prevmtd`.`prevmtd`,`customer_sales_curryr`.`curryr`,`customer_sales_prevytd`.`prevytd`,`customer_sales_prevyr`.`prevyr`,`invoices`.`customer` order by `customer_sales_curryr`.`curryr` desc;<br />
<br />
Does anyone have a suggestion on how I might resolve this? Thanks!]]></description>
            <dc:creator>P Kiran</dc:creator>
            <category>Views</category>
            <pubDate>Sat, 22 Sep 2012 13:55:53 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,569022,569022#msg-569022</guid>
            <title>Combining a tree structured Group model with its HABTM User model in one VIEW (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,569022,569022#msg-569022</link>
            <description><![CDATA[ Here is the situation:<br />
I have a tree structured model Group which has the columns id, parent_id, name, lft and rght. I also have a model User which has the columns id, name and password. Group and User have a HABTM relationship using the join-table groups_users<br />
<br />
Now I want to create a view which creates a new tree which includes all the groups and all the users as children of the groups they belong to. The view should have the columns id, parent_id, model, foreign_key, lft and rght.<br />
The id column should just be the nth row of course and parent_id, lft and rght can't be just copied from the Group model, they will have to calculated for the tree of the view.<br />
<br />
An example of what the view could look like:<br />
<br />
    | id | parent_id | model | foreign_key | lft | rght<br />
    ----------------------------------------------------<br />
    |  1 |    NULL   | Group |      1      |  1  |  14  <br />
    |  2 |     1     | User  |      1      |  2  |   3  <br />
    |  3 |     2     | Group |      2      |  4  |   7  <br />
    |  4 |     3     | User  |      3      |  5  |   6  <br />
    |  5 |     4     | Group |      3      |  8  |  13  <br />
    |  6 |     5     | User  |      2      |  9  |  10  <br />
    |  7 |     5     | User  |      4      | 11  |  12  <br />
    |  8 |    NULL   | Group |      4      | 15  |  20  <br />
    |  9 |     8     | User  |      4      | 16  |  17  <br />
    | 10 |     8     | User  |      5      | 18  |  19  <br />
<br />
Now my question is, how the hell do I do this?<br />
Can it be done with some super complex SELECT statement or do I need to use a procedure?<br />
I'm not super skilled at MySQL, I can do simple SELECTs and JOINs, but this is way beyond my skills.]]></description>
            <dc:creator>Evert van Brussel</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 20 Sep 2012 00:04:24 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,568963,568963#msg-568963</guid>
            <title>view data is retrieved in full underlying (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,568963,568963#msg-568963</link>
            <description><![CDATA[ We have a project tracking system our employees are required to fill out each day. They log in, select the project they worked on, and enter the number of hours they worked on it. Managers then run reports, for budgetary reasons, that show them the cost of each project. I fetch the report in a simple query that goes through all the projects (Projects table), joins each project up with their rate (Rates table), and sums up the cost for each project. The tricky part now is a manager may set a specific rate for an employee working on project X. Therefore when the query runs it must use a different rate (from the Rates table) for the given project / employee. <a href="http://storify.com/montyshely/sons-of-anarchy-season-5-episode-2-online-free"  rel="nofollow">sons of anarchy season 5 episode 2</a><br />
<br />
The calculation I'm using in the query is a basic: sum(RATE * HOURS) <br />
<br />
A quick summary of the table relationships: <br />
All projects have a &quot;default&quot; rate associated with them and thus will have 1 entry in Rates for each project. Any additional entries in Rates for a particular project will be because an empID was given to change the rate for a particular employee for that project. <br />
<a href="http://sonsofanarchys5e2i.tumblr.com/"  rel="nofollow">sons of anarchy season 5 episode 2</a><br />
The query I'm currently using to fetch a list of projects and their &quot;default&quot; costs: <br />
<br />
SELECT p.projID, p.projName, sum(r.rate * ph.hours) AS totalCost <br />
FROM Projects p, ProjectHours ph, Rates r <br />
WHERE p.projID=r.projID <br />
GROUP BY p.projID, p.projName <br />
<a href="http://sonsofanarchys5e2i.enjin.com/"  rel="nofollow">sons of anarchy season 5 episode 2</a><br />
Now I just need to throw in the twist of an specific employee having a different rate then the &quot;default&quot; rate for a particular project. Any help would be greatly appreciated. The creation of a View is acceptable... but I'd rather see if this is possible using some combination of JOINS.]]></description>
            <dc:creator>monty shely</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 19 Sep 2012 09:40:49 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,568286,568286#msg-568286</guid>
            <title>Help with read only view please (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,568286,568286#msg-568286</link>
            <description><![CDATA[ Hi,<br />
<br />
I've done some research on how to solve the non-updatable recordset problem but have not been able to figure it out, so I'm hoping somebody here can provide some direction. I can't think of how to make my view any simpler and I have all the necessary PKs defined.<br />
<br />
I have one simple table.  Here is the create table:<br />
<br />
<br />
CREATE TABLE `cast` (<br />
  `ID` int(11) NOT NULL AUTO_INCREMENT,<br />
<br />
&lt;snip&gt;<br />
<br />
  `ImportDate` datetime NOT NULL,<br />
  `ImportUser` varchar(15) DEFAULT NULL,<br />
  PRIMARY KEY (`ID`),<br />
  KEY `ImportDate` (`ImportDate`),<br />
) ENGINE=InnoDB AUTO_INCREMENT=37695 DEFAULT CHARSET=utf8$$<br />
<br />
<br />
This table will have thousands of records imported each day - it's a historical table.  What I want to do is create a view that gives me just todays records...but I need to be able to edit them.<br />
<br />
Here's the view I created:<br />
<br />
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `cast` AS select `c`.`Sales Series` AS `Sales Series`,`c`.`Account Number` AS `Account Number`,`c`.`Account Name` AS `Account Name`,`c`.`Account ID` AS `Account ID`,`c`.`ImportDate` AS `ImportDate`,`c`.`ImportUser` AS `ImportUser` from (`cast` `c` join `max_cast` on((`c`.`ImportDate` = `max_cast`.`MaxOfImportDate`)))<br />
<br />
and here's the view for the max_cast view that the above is joined with:<br />
<br />
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `max_cast` AS select max(`cast`.`ImportDate`) AS `MaxOfImportDate` from `cast`<br />
<br />
Any ideas on how I can accomplish this?  FYI, I will be using this view in MS Access.<br />
<br />
Thanks :)]]></description>
            <dc:creator>Bodi K</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 12 Sep 2012 16:19:18 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,558789,558789#msg-558789</guid>
            <title>MySQL View not responding? - URGENT (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,558789,558789#msg-558789</link>
            <description><![CDATA[ Hi All,<br />
<br />
I have two views in which I am able to run the select statement successfully but when i create it as a view with below statement example:<br />
<br />
create view XXXX as (select.....from....) is not working. It is ugent - Please help.]]></description>
            <dc:creator>Venugopal Saride</dc:creator>
            <category>Views</category>
            <pubDate>Mon, 25 Jun 2012 23:01:00 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,545819,545819#msg-545819</guid>
            <title>concat in where clause (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,545819,545819#msg-545819</link>
            <description><![CDATA[ # sorry wrong place to post # i dont know how to delete my post.<br />
<br />
Why doesn't these query work?<br />
<br />
1: <br />
<br />
select * from table where col in  (concat(&quot;\'&quot;,&quot;value&quot;,&quot;\'&quot;))<br />
<br />
2:<br />
<br />
select * from table where col1 = if ( col1 = 'value1', col1 = concat_ws(&quot; AND &quot;, &quot;\'value1\'&quot;,&quot;col2 = \'value2\'&quot; ) ,&quot;&quot;))]]></description>
            <dc:creator>pradeep kumar</dc:creator>
            <category>Views</category>
            <pubDate>Mon, 25 Jun 2012 23:00:05 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,544035,544035#msg-544035</guid>
            <title>if select does not work in view (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,544035,544035#msg-544035</link>
            <description><![CDATA[ Hi, I am new in mysql and i have a problem to display data in a view, but when I execute my querry without create view, the result is correct. It is only when the view is created  the coloumn in question is displaying zeros. My code is the following:<br />
<br />
select`p`.`Nom` AS `nom`, <br />
`p`.`Prenom` AS `prenom`, `c`.`Anne` AS `anne`,<br />
`c`.`Personnes_id` AS `Personnes_id`, <br />
`c`.`Date_Debut_Conge` AS `Date_Debut_Conge`, <br />
`c`.`Date_Fin_Conge` AS `Date_Fin_Conge`, <br />
`c`.`DemiJourneD` AS `DemiJourneD`,<br />
`c`.`DemiJourneF` AS `DemiJourneF`,<br />
`c`.`Type_Absence` AS `Type_absence`, <br />
`c`.`Notes` AS `Notes`,<br />
(select if (`c`.`Type_Absence`='congé',((select count(`congett`.`calendrier`.`WeekEnd`) from `congett`.`calendrier` <br />
 where ((`congett`.`calendrier`.`Date` between `c`.`Date_Debut_Conge` and `c`.`Date_Fin_Conge`) <br />
 and (`congett`.`calendrier`.`WeekEnd` &lt;&gt; 1) and (`congett`.`calendrier`.`CongeLULU` &lt;&gt; 1) and <br />
 (`congett`.`calendrier`.`AutreConge` &lt;&gt; 1))) - `c`.`DemiJourneD` - `c`.`DemiJourneF` +<br />
 `c`.`CongesDejaPris`  ),0)) AS `CongePris`,<br />
((select count(`congett`.`calendrier`.`WeekEnd`) from `congett`.`calendrier` where <br />
 (`congett`.`calendrier`.`Date` between `c`.`Date_Debut_Conge` and `c`.`Date_Fin_Conge`)) <br />
- `c`.`DemiJourneD` - `c`.`DemiJourneF`) AS `Quantite`<br />
  from Personnes p join conges_utilises c on p.id= c.`Personnes_id`<br />
<br />
Obviusly the issue is on the &quot;select if&quot; level, because the column is displaying &quot;0&quot; in the view.<br />
My sevrer version is 5.5.23]]></description>
            <dc:creator>Denis Kochlyak</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 30 May 2012 07:29:19 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,527553,527553#msg-527553</guid>
            <title>Adding firewall rule for MySQL55 on port 3306. (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,527553,527553#msg-527553</link>
            <description><![CDATA[ Adding firewall rule for MySQL55 on port 3306 failed.though mysql server is installed.please help me with this. <br />
 how can i solve it?]]></description>
            <dc:creator>mohit negi</dc:creator>
            <category>Views</category>
            <pubDate>Wed, 25 Apr 2012 21:26:39 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,526002,526002#msg-526002</guid>
            <title>Can Trigger check authorization ? (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,526002,526002#msg-526002</link>
            <description><![CDATA[ Hello,<br />
I see in the doc that a trigger can be fired before and/or after the table is actually updated.<br />
Can a before-trigger start a procedure or any other process to check the authorization of a user to perform the requested sql command on that particular table?<br />
Thanks.]]></description>
            <dc:creator>Didier Morandi</dc:creator>
            <category>Views</category>
            <pubDate>Tue, 17 Apr 2012 12:34:13 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,525867,525867#msg-525867</guid>
            <title>create view with new field that counts duplicate entries (no replies)</title>
            <link>http://forums.mysql.com/read.php?100,525867,525867#msg-525867</link>
            <description><![CDATA[ I have a table where i track test data.  I would like to create a view with a new field for counting, so when a duplicate entry is made on a serial number field the counter will auto increment by 1.  Is this possible? I have been searching and have not found anything yet that will work.]]></description>
            <dc:creator>Kenny Ford</dc:creator>
            <category>Views</category>
            <pubDate>Mon, 16 Apr 2012 15:25:34 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,521235,521235#msg-521235</guid>
            <title>Create VIEW table using multiple inner join &amp; union error (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,521235,521235#msg-521235</link>
            <description><![CDATA[ hi..<br />
below this is my working sql statement. i need to convert this to a VIEW table format.<br />
<br />
<pre class="bbcode">
SELECT a.item, b.item_id, b.item_name, a.certification_id, c.certification_type,  a.certification_serial_no, a.certification_status, a.row_id 
FROM 
(SELECT mitrace_business_location_certification.business_location_id AS item_id, 'GLN' AS item, certification_id, certification_serial_no, certification_status, id AS row_id FROM mitrace_business_location_certification WHERE  certification_status IS NOT NULL AND deleted=FALSE
UNION 
SELECT  mitrace_epc_certification.epc_id AS item_id, 'GTIN' AS item, certification_id, certification_serial_no, epc_certification_status AS certification_status, id AS row_id FROM mitrace_epc_certification WHERE epc_certification_status IS NOT NULL AND deleted=FALSE) a

INNER JOIN (SELECT mitrace_business_location.location_code AS item_name, 'GLN' AS item, id AS item_id FROM mitrace_business_location WHERE location_code IS NOT NULL AND deleted=FALSE
UNION
SELECT mitrace_epc.code AS item_name, 'GTIN' AS item, id AS item_id FROM mitrace_epc WHERE id IS NOT NULL AND deleted=FALSE) b 
ON b.item_id=a.item_id

INNER JOIN mitrace_certification c 
ON c.id=a.certification_id;</pre>
<br />
When i changed it, it gives syntax error at the 1st inner join.<br />
<br />
<pre class="bbcode">
DROP TABLE IF EXISTS mitrace_view_epc_bizloc_certs;
CREATE OR REPLACE
VIEW mitrace_view_epc_bizloc_certs AS SELECT a.item, b.item_id, b.item_name, a.certification_id, c.certification_type,  a.certification_serial_no, a.certification_status, a.row_id, 

(SELECT mitrace_business_location_certification.business_location_id AS item_id, 'GLN' AS item, certification_id, certification_serial_no, certification_status, id AS row_id FROM mitrace_business_location_certification WHERE  certification_status IS NOT NULL AND deleted=FALSE
UNION 
SELECT  mitrace_epc_certification.epc_id AS item_id, 'GTIN' AS item, certification_id, certification_serial_no, epc_certification_status AS certification_status, id AS row_id FROM mitrace_epc_certification WHERE epc_certification_status IS NOT NULL AND deleted=FALSE) a

INNER JOIN 
(SELECT mitrace_business_location.location_code AS item_name, 'GLN' AS item, id AS item_id FROM mitrace_business_location WHERE location_code IS NOT NULL AND deleted=FALSE
UNION
SELECT mitrace_epc.code AS item_name, 'GTIN' AS item, id AS item_id FROM mitrace_epc WHERE id IS NOT NULL AND deleted=FALSE) b 
ON b.item_id=a.item_id

INNER JOIN mitrace_certification c 
ON c.id=a.certification_id;</pre>
<br />
please help....]]></description>
            <dc:creator>MAGESH GEORGE</dc:creator>
            <category>Views</category>
            <pubDate>Fri, 23 Mar 2012 07:19:50 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,518687,518687#msg-518687</guid>
            <title>CREATE VIEW vs JOIN (1 reply)</title>
            <link>http://forums.mysql.com/read.php?100,518687,518687#msg-518687</link>
            <description><![CDATA[ Hi everyone,<br />
<br />
I have the following query:<br />
<br />
    SELECT t.*, a.hits AS ahits <br />
					FROM t, a <br />
					WHERE (t.TRACK LIKE 'xxx')<br />
					AND a.A_ID = t.A_ID<br />
					ORDER BY t.hits DESC, a.hits DESC<br />
<br />
which runs very frequently. Table `t` has around 15M+ rows and `a` has around 3M+ rows. <br />
<br />
When I did an `EXPLAIN` on the above query, I received a note saying that it always created a temp table. I noticed that creating a temp table based on the above query took quite a while. And, this is done plenty of time.<br />
<br />
Thus, I am wondering if I create a view using the above say:<br />
<br />
    CREATE VIEW v_t_a <br />
    SELECT t.*, a.hits AS ahits<br />
    FROM t, a<br />
    WHERE a.A_ID = t.A_ID<br />
<br />
And change my code to:<br />
<br />
    SELECT * FROM v_t_a WHERE TRACK LIKE 'xxx' ORDER BY hits DESC, ahits DESC<br />
<br />
Will it improve the performance? Will it remove the create temp table time?<br />
<br />
Thank you so much for your help!]]></description>
            <dc:creator>Heru Setiawan</dc:creator>
            <category>Views</category>
            <pubDate>Tue, 06 Mar 2012 20:57:42 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,516778,516778#msg-516778</guid>
            <title>OR clause Vs In Clause in Views (3 replies)</title>
            <link>http://forums.mysql.com/read.php?100,516778,516778#msg-516778</link>
            <description><![CDATA[ mysql Server version: 5.1.41 <br />
ubuntu 10.04<br />
<br />
i came across a scenario when modifying queries and wanted to know why MySQL behaved differently - <br />
Basically i am creating a view and when i query the view, the number of rows read are different for an &quot;IN&quot; clause and for an &quot;OR&quot; clause - below is a simple example <br />
<br />
Note that the result set is the same for both queries<br />
<br />
CREATE TABLE country (<br />
 id_country int(11) NOT NULL AUTO_INCREMENT,<br />
 name varchar(50) NOT NULL,<br />
 PRIMARY KEY (id_country)<br />
) ENGINE=InnoDB;<br />
<br />
INSERT INTO country (name) VALUES ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H');<br />
<br />
CREATE TABLE status (<br />
 id_status int(11) NOT NULL AUTO_INCREMENT,<br />
 id_country int(11) NOT NULL,<br />
 status tinyint(4) NOT NULL,<br />
 PRIMARY KEY (id_status)<br />
) ENGINE=InnoDB;<br />
ALTER TABLE  status ADD INDEX (  id_country );<br />
ALTER TABLE  status ADD FOREIGN KEY (  id_country ) REFERENCES  test.country (id_country) ON DELETE RESTRICT ON UPDATE RESTRICT ;<br />
<br />
INSERT INTO status(id_country, status) VALUES <br />
(1,0), (2,1), (3,0), (4,1), (5,0),(6,1), (7,0), (8,1);<br />
<br />
CREATE <br />
ALGORITHM=MERGE <br />
VIEW view_country AS <br />
SELECT c.*, s.id_status, s.status <br />
FROM country c JOIN status s ON c.id_country = s.id_country;<br />
<br />
===================================================================================<br />
The below 2 explain statements show different number of rows parsed<br />
<br />
EXPLAIN EXTENDED <br />
SELECT * FROM view_country WHERE id_country IN (1, 2, 3);<br />
<br />
EXPLAIN EXTENDED <br />
SELECT * FROM view_country WHERE id_country = 1 OR id_country = 2 OR id_country = 3;<br />
<br />
The query with &quot;OR&quot; clause reads lesser rows compared to &quot;IN&quot; - and this adds up for huge tables and joins <br />
<br />
Can someone help me understand why this is so <br />
<br />
Thank you for your time.]]></description>
            <dc:creator>Naveen Nayak</dc:creator>
            <category>Views</category>
            <pubDate>Tue, 06 Mar 2012 20:56:35 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?100,513149,513149#msg-513149</guid>
            <title>Searching a varbinary field as a number (2 replies)</title>
            <link>http://forums.mysql.com/read.php?100,513149,513149#msg-513149</link>
            <description><![CDATA[ Hello,<br />
I am new to mySQL so still learning.  I have created some views using tables in which I have concatenated a text and number (REAL) field together.  However, when I search this new field in the view (now a varbinary field), I'd still like to search it based on the separate number field of which it is constructed.  However, it is searched as the varbinary.  Is it possble to search as a number but display as the concatenated version (easier to look at and decreases width of view).<br />
thanks in advance,<br />
melissa]]></description>
            <dc:creator>Melissa Jacob</dc:creator>
            <category>Views</category>
            <pubDate>Thu, 02 Feb 2012 13:36:48 +0000</pubDate>
        </item>
    </channel>
</rss>
