有关使用TOP命令的MySql查询

时间:2016-08-17 11:26:55

标签: mysql

错误1064(42000):您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便在第1行class GameScene: SKScene { lazy var pauseButton: PauseButton = PauseButton(theTexture: pauseButtonTexture,gameScene: self) var someBool = false override func didMoveToView(view: SKView) { addChild(pauseButton) pauseButton.loadPausedLabel() } func someMethod() { } } class PauseButton: SKSpriteNode { func loadPauseLabel() { // Way 1, reference to current scene but not to specific class guard let scene = scene else { return } // Scene property is optional and is nil until button is added to a Scene so add the guard check. scene.someBool = true // NOT WORKING scene.someMethod() // NOT WORKING let label = SKLabelNode(... scene.addChild(label) // WORKING // Way 2, use "as" to cast to specific scene (e.g GameScene) so you can call properties/methods on it. This is the same as passing GameScene in the init method. guard let gameScene = scene as? GameScene else { return } // Scene property is optional and is nil until button is added to a Scene so add the guard check. // The button must be added to the scene you are trying the as? cast with, in this example GameScene. gameScene.someBool = true // WORKING gameScene.someMethod() // WORKING let label = SKLabelNode(... gameScene.addChild(label) // WORKING } } 附近使用正确的语法

'(2) from empdata where empid='E-713''

如何使用MySql中的top命令获得第n个最高薪水。虽然根据我的知识我的语法是正确的,但按下输入上面的错误闪现。

1 个答案:

答案 0 :(得分:1)

评论时间有点长。

MySQL不支持SELECT TOP。这通常与SQL Server相关联。

支持LIMIT,所以你可以写:

delete ed
    from empdata ed
    where empid = 'E-713'
    limit 2;

但是,这非常危险,因为它删除了两个任意行。几乎在所有情况下,您都需要ORDER BY

delete ed
    from empdata ed
    where empid = 'E-713'
    order by ??
    limit 2;

无论您使用的是TOP还是LIMIT,都是如此。