Returning TOP Records
Microsoft SQL Server
SELECT TOP 10 column FROM table
MySQL
SELECT column FROM table LIMIT 10
Returning TOP PERCENT Records
Microsoft SQL Server
SELECT TOP 50 PERCENT * FROM table
MySQL
SELECT @percentage := ROUND(COUNT(*) * 50/100) FROM table;
PREPARE STMT FROM 'SELECT * FROM table LIMIT ?';
EXECUTE STMT USING @percentage;
Không có nhận xét nào:
Đăng nhận xét