Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

How query data using ORDER BY FIELD

I want to query XAP with an IN clause and to order the results by the members of the IN clause.

In normal SQL, this is accomplished this way:

select * from MyTable where name IN ('TOM', 'DICK', 'HARRY') ORDER BY FIELD(name, ['TOM', 'DICK', 'HARRY'])

How do I accomplish the same thing with XAP SQLQuery?

Thank you.

asked 2014-12-18 12:28:49 -0500

Steve McCarthy gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Hi,

Currently We don't support ORDER BY with column value (e.g ['TOM', 'DICK', 'HARRY'])

You can do either:

results = gigapace.readMultiple(new SQLQuery<myclass>(MyClass.class, "name IN ('TOM', 'DICK', 'HARRY') ORED BY name asc"));

or:

results = gigapace.readMultiple(new SQLQuery<myclass>(MyClass.class, "name IN ('TOM', 'DICK', 'HARRY') ORED BY name desc"));

B.T.W - ORDER BY performance In version 10.1 was improved.

Regards,

Yuval

answered 2014-12-22 02:54:29 -0500

Yuval gravatar image
edit flag offensive delete link more

Comments

Aggregators can be used to implement such ordering.

shay hassidim gravatar imageshay hassidim ( 2014-12-22 07:57:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-12-18 12:28:49 -0500

Seen: 2,958 times

Last updated: Dec 22 '14