Ask a Question related to Coldfusion Database Access, Design and Development.
-
dj shane #1
SELECT * / Order of Columns
Hey guys, is there a way to re-arrange the order of columns when using SELECT *
- I don't normally use SELECT *, but am forced to in a current situation and
would like to re-arrange the order of the columns.
dj shane Guest
-
How to programatically order columns in anAdvancedDataGrid
Hello all, I have no problems programmatically ordering columns in a standard DataGrid - however doing the same in an AdvancedDataGrid is proving... -
Selecting all columns, but in a different order in SELECT statement
Thanks, i thought that was the case... just wanted to confirm it before i started working on it. Alex "Vishal Parkar" <vgparkar@hotmail.com>... -
Pad strings/concatenate columns to simulate data columns in ASP select box with SQL Server 2K
Dale, Cast all the data to fixed character data type in your select statement. For example: select cast(au_id as char(12)) +... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Following is my stored procedure. If I take the DISTINCT out then everything works fine. BUT I need the distinct because it returns duplicate... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id, -
rmorgan #2
Re: SELECT * / Order of Columns
Order by and/or group by should give you what you want on your output.
rmorgan Guest
-
philh #3
Re: SELECT * / Order of Columns
In what order do you want them? You can use a list function to sort them
alphanumerically, but (I think) that's the way they are returned in
query.ColumnList. If you need them in a certain order, but not
alphanumerically, that would signify that you knew what fields are being
returned by the query, and you would have to apply rules based on which column
list you expected.
philh Guest
-
dj shane #4
Re: SELECT * / Order of Columns
rMorgan, sorry not order by veritically, I ment ordering the columns
Example, SELECT * FROM TABLE
Brings back the columsn, Name, Address, Height, Weight, EyeColor in that order
from the database.
But I want them in a different order. Perhaps, Height, Weight, Name, Address,
EyeColor.
Again, I hate select *, but I must use it in this case.
dj shane Guest
-
Dan Bracuk #5
Re: SELECT * / Order of Columns
And will you know the field names and desired sorting order in advance?
Originally posted by: dj shane
rMorgan, sorry not order by veritically, I ment ordering the columns
Example, SELECT * FROM TABLE
Brings back the columsn, Name, Address, Height, Weight, EyeColor in that order
from the database.
But I want them in a different order. Perhaps, Height, Weight, Name, Address,
EyeColor.
Again, I hate select *, but I must use it in this case.
Dan Bracuk Guest
-
_silence #6
Re: SELECT * / Order of Columns
1. Why do you HAVE to use select *? Bad practice....
2. Why do you care what order the columns are selected? It really makes no difference...
_silence Guest
-
Matt.Stuart #7
Re: SELECT * / Order of Columns
To specify the order of your columns you need to list them explicitly in your
select list.
Ie, if SELECT * returns columns in A, B, C order but you want them in B A C or
C B A or something then you do:
SELECT B, A, C FROM ...
SELECT C, B, A FROM..
If you specify the columns you want they will be returned in the order you
specify. If there are too many columns for you to list them like this, you have
a bigger problem, your DB schema sucks.
Matt.Stuart Guest



Reply With Quote

