In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to realize the sentence with similar function of rownum in MySQL". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to achieve sentences with similar rownum functions in MySQL".
How to implement ROWNUM2010/01/28 23:56 > SELECT * FROM frutas of Oracle by MySQL
+-+ +
| | nombre | color |
+-+ +
| | fresa | rojo |
| | platano | amarillo |
| | manzana | verde |
| | uva | verde |
| | pera | verde |
| | mandarina | naranja |
| | melocoton | marron |
| | limon | amarillo |
+-+ +
8 rows in set (01.00 sec)
[a sql statement is completed without set variables]
SELECT @ rownum:=@rownum+1 AS rownum, frutas.*
FROM (SELECT @ rownum:=0) r, frutas
Mysql > SELECT @ rownum:=@rownum+1 AS rownum, frutas.*
-> FROM (SELECT @ rownum:=0) r, frutas
+-+
| | rownum | nombre | color | |
+-+
| | 1 | fresa | rojo |
| | 2 | platano | amarillo |
| | 3 | manzana | verde |
| | 4 | uva | verde |
| | 5 | pera | verde |
| | 6 | mandarina | naranja |
| | 7 | melocoton | marron |
| | 8 | limon | amarillo |
+-+
8 rows in set (01.00 sec)
But how to put this query in create view
Mysql > CREATE VIEW vw_frutas AS SELECT @ rownum:=@rownum+1 AS rownum, frutas.*
-> FROM (SELECT @ rownum:=0) r, frutas
ERROR 1351 (HY000): View's SELECT contains a variable or parameter
At this point, I believe you have a deeper understanding of "how to achieve statements similar to rownum functions in MySQL". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.