ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to display columns in the right order from a SQL DB query (https://www.excelbanter.com/excel-programming/396544-how-display-columns-right-order-sql-db-query.html)

Neall

How to display columns in the right order from a SQL DB query
 
I am using a universal SQL editor and when I get the results from my DB query
using that tool, the columns are in the correct order in which I have placed
them.

However when I use the same SQL query in Excel and the data is displayed the
columns are in the wrong order.

Any suggestions

--
Neall

Pranav Vaidya

How to display columns in the right order from a SQL DB query
 
This is very little infor to answer. I need to know the SQL you are using,
however try using the actual column names instead of * in your SELECT
statement.

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Neall" wrote:

I am using a universal SQL editor and when I get the results from my DB query
using that tool, the columns are in the correct order in which I have placed
them.

However when I use the same SQL query in Excel and the data is displayed the
columns are in the wrong order.

Any suggestions

--
Neall


Neall

How to display columns in the right order from a SQL DB query
 
Here is and example of what I am doing

SELECT
XXX.DAYSOPEN "XXX AGE",
XXX.PM "XXX #",
XXX.BNO,
XXX.CNO,
XXX.SEVERITY"SEV",
XXX.CUST "CUSTOMER",
XXX.PROD "PROD",
FROM
AAAAA.XXX AS XXX

LEFT JOIN SER.DIS AS DIS (took out some of the join info)

LEFT JOIN SER.XXX AS LXXX (took out some of the join info)

WHERE XXX.STAT = 'O' AND
XXX.PRODID IN ('VVVV', 'BBBB', 'CCCC')


ORDER BY XXX.DAYSOPEN DESC

Again all the information is retrieved correctly but the order in which I
have the select statement does not come back the same order
--
Neall


"Pranav Vaidya" wrote:

This is very little infor to answer. I need to know the SQL you are using,
however try using the actual column names instead of * in your SELECT
statement.

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Neall" wrote:

I am using a universal SQL editor and when I get the results from my DB query
using that tool, the columns are in the correct order in which I have placed
them.

However when I use the same SQL query in Excel and the data is displayed the
columns are in the wrong order.

Any suggestions

--
Neall


Tim Williams

How to display columns in the right order from a SQL DB query
 
How are you displaying the returned info in excel ??

Tim

"Neall" wrote in message
...
Here is and example of what I am doing

SELECT
XXX.DAYSOPEN "XXX AGE",
XXX.PM "XXX #",
XXX.BNO,
XXX.CNO,
XXX.SEVERITY"SEV",
XXX.CUST "CUSTOMER",
XXX.PROD "PROD",
FROM
AAAAA.XXX AS XXX

LEFT JOIN SER.DIS AS DIS (took out some of the join info)

LEFT JOIN SER.XXX AS LXXX (took out some of the join info)

WHERE XXX.STAT = 'O' AND
XXX.PRODID IN ('VVVV', 'BBBB', 'CCCC')


ORDER BY XXX.DAYSOPEN DESC

Again all the information is retrieved correctly but the order in which I
have the select statement does not come back the same order
--
Neall


"Pranav Vaidya" wrote:

This is very little infor to answer. I need to know the SQL you are
using,
however try using the actual column names instead of * in your SELECT
statement.

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Neall" wrote:

I am using a universal SQL editor and when I get the results from my DB
query
using that tool, the columns are in the correct order in which I have
placed
them.

However when I use the same SQL query in Excel and the data is
displayed the
columns are in the wrong order.

Any suggestions

--
Neall




Neall

How to display columns in the right order from a SQL DB query
 
Thanks for responding, I figured out the issue, now onto my next post.

Thanks again
--
Neall


"Tim Williams" wrote:

How are you displaying the returned info in excel ??

Tim

"Neall" wrote in message
...
Here is and example of what I am doing

SELECT
XXX.DAYSOPEN "XXX AGE",
XXX.PM "XXX #",
XXX.BNO,
XXX.CNO,
XXX.SEVERITY"SEV",
XXX.CUST "CUSTOMER",
XXX.PROD "PROD",
FROM
AAAAA.XXX AS XXX

LEFT JOIN SER.DIS AS DIS (took out some of the join info)

LEFT JOIN SER.XXX AS LXXX (took out some of the join info)

WHERE XXX.STAT = 'O' AND
XXX.PRODID IN ('VVVV', 'BBBB', 'CCCC')


ORDER BY XXX.DAYSOPEN DESC

Again all the information is retrieved correctly but the order in which I
have the select statement does not come back the same order
--
Neall


"Pranav Vaidya" wrote:

This is very little infor to answer. I need to know the SQL you are
using,
however try using the actual column names instead of * in your SELECT
statement.

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Neall" wrote:

I am using a universal SQL editor and when I get the results from my DB
query
using that tool, the columns are in the correct order in which I have
placed
them.

However when I use the same SQL query in Excel and the data is
displayed the
columns are in the wrong order.

Any suggestions

--
Neall






All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com