0

I am trying to display a SimpleDB query and noticed that the order of the attributes are not always the same per query.

For example, one query result might look like:

Item
  URL:....
  Date:...

then another query might look like this:

Item
  Date:...
  URL:....

The order by sorts out each item but does it sort the attributes? is there a way to always have the attributes sorted in an alphabetical order?

I am using java to access the db.

Query: selectExpression = "select * from" + "urlswhere url = '" + "stack.com" +"'";

Dan
  • 8,263
  • 16
  • 51
  • 53

3 Answers3

0
selectExpression = "select * from" + "urlswhere url = '" + "stack.com" +"' order by          {column} DESC";

Replace the {column} with required column name

Shamis Shukoor
  • 2,515
  • 5
  • 29
  • 33
  • Not quite understand. if I put `selectExpression = "select * from" + "urlswhere url = '" + "stack.com" +"' order by URL desc";` I get an error `InvalidSortExpression` – Dan Nov 19 '12 at 05:59
0

According to AWS, Amazon SimpleDB supports sorting data on a single attribute. I will have to write my own comparator to do the sorting since it there is no guarantee of order for multiple attributes.

Dan
  • 8,263
  • 16
  • 51
  • 53
0

Amazon Simple DB does not support listing the attributes in the same order because Amazon Simple DB provides flexibility to add new attributes that only applies to certain rows therefore each row may have different-different attributes and Amazon SimpleDB does not guarantee the order of records returned.

Ashish Pancholi
  • 4,569
  • 13
  • 50
  • 88