seany123 Posted April 28, 2009 Share Posted April 28, 2009 Can someone tell me what exactly VIEW is doing in this piece of code?? and if it would be possible to edit this to so it can be used with mySQL Version 4.5. -- -------------------------------------------------------- CREATE VIEW `guild_scores` AS select `guilds`.`id` AS `guild_id`,((max(`guilds`.`gold`) + sum(`players`.`kills`)) - sum(`players`.`deaths`)) AS `score` from (`guilds` join `players`) where (`players`.`guild_id` = `guilds`.`id`) group by `guilds`.`id` order by ((max(`guilds`.`gold`) + sum(`players`.`kills`)) - sum(`players`.`deaths`)) desc; -- -------------------------------------------------------- CREATE VIEW `guild_member_ranks` AS (select `gm`.`guild_id` AS `guild_id`,`guilds`.`name` AS `guild_name`,`players`.`id` AS `player_id`,`players`.`username` AS `username`,(case `players`.`username` when `guilds`.`leader` then 1 else 0 end) AS `IsLeader`,`guild_ranks`.`id` AS `rank_id`,`guild_ranks`.`name` AS `rank`,(case `players`.`username` when `guilds`.`leader` then 1 else `guild_ranks`.`admin` end) AS `admin`,(case `players`.`username` when `guilds`.`leader` then 1 else `guild_ranks`.`kick` end) AS `kick`,(case `players`.`username` when `guilds`.`leader` then 1 else `guild_ranks`.`invite` end) AS `invite`,(case `players`.`username` when `guilds`.`leader` then 1 else `guild_ranks`.`officers` end) AS `officers`,(case `players`.`username` when `guilds`.`leader` then 1 else `guild_ranks`.`treasury` end) AS `treasury` from (((`guild_members` `gm` join `players` on((`gm`.`player_id` = `players`.`id`))) join `guilds` on((`guilds`.`id` = `gm`.`guild_id`))) left join `guild_ranks` on((`gm`.`rank_id` = `guild_ranks`.`id`)))); Quote Link to comment https://forums.phpfreaks.com/topic/156032-views/ Share on other sites More sharing options...
premiso Posted April 28, 2009 Share Posted April 28, 2009 Do you understand what a View is? http://en.wikipedia.org/wiki/View_(database) EDIT: As for views working in MySQL 4.5 you cannot. http://dev.mysql.com/tech-resources/articles/mysql-views.html MySQL Views were released in 5. Quote Link to comment https://forums.phpfreaks.com/topic/156032-views/#findComment-821437 Share on other sites More sharing options...
seany123 Posted April 28, 2009 Author Share Posted April 28, 2009 no im not asking for a way to make VIEW work on mysql 4.5.... im asking if someone knew a alternative to so it doesnt have to use VIEW, in which case it will work on mysql 4.5 Quote Link to comment https://forums.phpfreaks.com/topic/156032-views/#findComment-821441 Share on other sites More sharing options...
fenway Posted April 29, 2009 Share Posted April 29, 2009 1) there is no v4.5 of mysql 2) you can just use the select statement iself Quote Link to comment https://forums.phpfreaks.com/topic/156032-views/#findComment-821778 Share on other sites More sharing options...
seany123 Posted April 29, 2009 Author Share Posted April 29, 2009 i said 4.5ish because i know that the mysql version is around that area. so its possible to just use the select statement... EDIT: ive just switched hosts from freehostia.com -> awardspace.net... so im gonna be able to use mysql v5 after all. Quote Link to comment https://forums.phpfreaks.com/topic/156032-views/#findComment-821833 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.