Excel and SQL, order by help
Posted
by perlnoob
on Stack Overflow
See other posts from Stack Overflow
or by perlnoob
Published on 2010-05-06T21:50:46Z
Indexed on
2010/05/06
21:58 UTC
Read the original article
Hit count: 316
Im stuck in Excel 2007, running a query, it worked until I wanted to add a 2nd row containing "field 2".
Select "Site Updates"."Posted By", "Site Uploaded"."Site Upload Date"
From site_info.dbo."Site Updates"
Where ("Site Updates"."Posted By") AND "Site Uploaded"."Site Upload Date">={ts '2010-05-01 00:00:00'}), ("Site Location"='Chicago')
Union all
Select "Site Updates"."Posted By", "Site Uploaded"."Site Upload Date"
From site_info.dbo."Site Updates"
Where ("Site Updates"."Posted By") AND "Site Uploaded"."Site Upload Date">={ts '2010-05-01 00:00:00'}), ("Site Location"='Denver')
Order By "Site Location" ASC;
Basically I want 2 different cells for the locations, example
name - Chicago - denver
user1 - 100 - 20
user2 - 34 - 1002
Right now for some odd reason, its combining it like:
name - chicago
user1 - 120
user2 - 1036
Please note updating to 2010 beta is not a viable option for me at this point. Any and all input that will help me is greatly apprecaited. I have read over http://www.techonthenet.com/sql/order_by.php however its not gotten me very far in this question. If you have another SQL resource you recomend for people trying to get their feet wet, I'd greatly apprecaite it.
If it helps all the info is on the same table.
© Stack Overflow or respective owner