Select to view content in your preferred language

follow up query layer question

538
2
Jump to solution
03-15-2012 10:37 AM
maxsteinbrenner
Emerging Contributor
so i am liking query layers a lot so far in playing with them!

my current question regards how keep the order i specify for the fields.

here is a query i am working with as an example:

SELECT sde2.sde.STREETCL_ARC.OBJECTID, sde2.sde.STREETCL_ARC.Shape, sde2.sde.STREETCL_ARC.SEG_ID, LTRIM(sde2.sde.STREETCL_ARC.PRE_DIR +' ' + sde2.sde.STREETCL_ARC.ST_NAME +' ' + sde2.sde.STREETCL_ARC.ST_TYPE) AS STREETNAME, sde2.sde.STREETCL_ARC.ST_CODE, sde2.sde.STREETCL_ARC.ONEWAY, sde2.sde.STREETCL_ARC.CLASS, sde2.sde.BIKE_NETWORK_TBL_NEW.TYPE FROM sde2.sde.STREETCL_ARC  RIGHT OUTER JOIN sde2.sde.BIKE_NETWORK_TBL_NEW ON sde2.sde.STREETCL_ARC.seg_id = sde2.sde.BIKE_NETWORK_TBL_NEW.SEG_ID


this makes a nice query layer with all the info i want HOWEVER if you notice i concatinate the field STREETNAME from a few fields. whenever the query layer is displayed this field shows up last. is there anyway to preserve the order i specify above (keep STREETNAME as the 4th column between SEG_ID and ST_CODE)?

thanks,

max
0 Kudos
1 Solution

Accepted Solutions
VinceAngelo
Esri Esteemed Contributor
I doubt the query code does any re-ordering of the SQL expression...
Which RDBMS are you using?
What happens when you issue the same SQL as a command at the SQL prompt?

- V

BTW: If you include your SQL in multi-line format, you'll probably get more folks to read it:

SELECT sde2.sde.STREETCL_ARC.OBJECTID,         sde2.sde.STREETCL_ARC.Shape,        sde2.sde.STREETCL_ARC.SEG_ID,         LTRIM(sde2.sde.STREETCL_ARC.PRE_DIR +' '               + sde2.sde.STREETCL_ARC.ST_NAME +' '              + sde2.sde.STREETCL_ARC.ST_TYPE) AS STREETNAME,        sde2.sde.STREETCL_ARC.ST_CODE,        sde2.sde.STREETCL_ARC.ONEWAY,         sde2.sde.STREETCL_ARC.CLASS,         sde2.sde.BIKE_NETWORK_TBL_NEW.TYPE FROM   sde2.sde.STREETCL_ARC  RIGHT OUTER JOIN sde2.sde.BIKE_NETWORK_TBL_NEW ON     sde2.sde.STREETCL_ARC.seg_id = sde2.sde.BIKE_NETWORK_TBL_NEW.SEG_ID

View solution in original post

0 Kudos
2 Replies
VinceAngelo
Esri Esteemed Contributor
I doubt the query code does any re-ordering of the SQL expression...
Which RDBMS are you using?
What happens when you issue the same SQL as a command at the SQL prompt?

- V

BTW: If you include your SQL in multi-line format, you'll probably get more folks to read it:

SELECT sde2.sde.STREETCL_ARC.OBJECTID,         sde2.sde.STREETCL_ARC.Shape,        sde2.sde.STREETCL_ARC.SEG_ID,         LTRIM(sde2.sde.STREETCL_ARC.PRE_DIR +' '               + sde2.sde.STREETCL_ARC.ST_NAME +' '              + sde2.sde.STREETCL_ARC.ST_TYPE) AS STREETNAME,        sde2.sde.STREETCL_ARC.ST_CODE,        sde2.sde.STREETCL_ARC.ONEWAY,         sde2.sde.STREETCL_ARC.CLASS,         sde2.sde.BIKE_NETWORK_TBL_NEW.TYPE FROM   sde2.sde.STREETCL_ARC  RIGHT OUTER JOIN sde2.sde.BIKE_NETWORK_TBL_NEW ON     sde2.sde.STREETCL_ARC.seg_id = sde2.sde.BIKE_NETWORK_TBL_NEW.SEG_ID
0 Kudos
maxsteinbrenner
Emerging Contributor
hmmm, i can't get it to replicate the problem again this morning...

probably user error.

thanks again for your help, and the tip on proper sql query code indentation.

max
0 Kudos