Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Laylow
Starting Member
14 Posts |
Posted - 2011-05-11 : 09:45:54
|
| Dear Experts,I am relatively new to SQL.I wrote a query using Microsoft SQL Server Management Studio.I then inserted this query into excel using workbook connections.The issue is that my column results do not appear in the same order of my query.Example[CODE]SELECT CODE, MAX(PERIOD), JRNALFROM TABLE AWHERE (JRNAL LIKE 'MTP'[/CODE]My result is coming out in the following format:CODE ---- JRNAL ----- PERIODRegardsLaylow |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-11 : 09:53:02
|
May be because MAX(PERIOD) has no column name.SELECT CODE, MAX(PERIOD) AS PERIOD, JRNAL No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Laylow
Starting Member
14 Posts |
Posted - 2011-05-11 : 10:17:54
|
quote: Originally posted by webfred May be because MAX(PERIOD) has no column name.SELECT CODE, MAX(PERIOD) AS PERIOD, JRNAL No, you're never too old to Yak'n'Roll if you're too young to die.
Hi,I have tried labelling all columns as you have described but I find it very strange its still not working. Would I need to create derived tables?Also I have run a few queries like this without problems.Please help.RegardsLaylow |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-11 : 10:23:36
|
quote: I then inserted this query into excel using workbook connections.
I do not know anything about that.Perhaps another mate here is able to help... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|