Jump to content

MySQL help


zeezack

Recommended Posts

What is wrong with this statement?

 

SELECT ACTION_CODE ACTION_CODE,ACTION_LEVEL ACTION_LEVEL,ACTION_MASTER ACTION_MASTER FROM ( SELECT alias.ACTION_CODE ,alias.ACTION_LEVEL ,alias.ACTION_MASTER , rownum r FROM ( SELECT ACTION_CODE ,ACTION_LEVEL ,ACTION_MASTER FROM ACTION_CODES ORDER BY ACTION_CODE ) alias WHERE rownum <= 4 ) WHERE r > 4

Link to comment
Share on other sites

I think I have sorted out the spaces..but I still get an error? Is the mysql wrong..do I need to make an AS or something?

 

SELECT ACTION_CODE ACTION_CODE,ACTION_LEVEL ACTION_LEVEL,ACTION_MASTER ACTION_MASTER FROM ( SELECT alias.ACTION_CODE,alias.ACTION_LEVEL,alias.ACTION_MASTER, rownum r FROM ( SELECT ACTION_CODE,ACTION_LEVEL,ACTION_MASTER FROM ACTION_CODES ORDER BY ACTION_CODE ) alias WHERE rownum <= 4 ) WHERE r > 4

 

Link to comment
Share on other sites

Then it is wrong, you cannot have spaces like that in an SQL statement for field names without surrounding them in parenthesis, this doesn't matter if its PERL, PHP, VB.NET, they are field names from the table/s you are basing the SELECT on and the space will cause the statement to error.

 

I imagine, that you may be using Constants to dynamically select fields but if thats the case you need to do this differently. Can you tell me what they are meant to be? Are they field names or some sort of constant or variable used to set the field name?

Link to comment
Share on other sites

 

 

Oracle issue - this is connecting to an oracle database

 

 

sooooo the sql for this according to the document should be

 

 

SELECT ACTION_CODE ACTION_CODE,ACTION_LEVEL ACTION_LEVEL,

      ACTION_MASTER ACTION_MASTER

FROM (SELECT alias.ACTION_CODE, alias.ACTION_LEVEL,

      alias.ACTION_MASTER, rownum r

      FROM ( SELECT ACTION_CODE,ACTION_LEVEL,ACTION_MASTER

            FROM ACTION_CODES

            ORDER BY ACTION_CODE

          )

        alias WHERE rownum <= 4

      )

WHERE r > 4

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.