SPARQL - How to use group_concate and Order By together? - sparql

I am new to SPARQL, I have observed that when I am using group_concate function and ORDER BY Clause together, it stops ordering. I don't know why its happening.
Please let me know the solution
Thanks in advance
sayali

Related

Understanding random ordering in Rails + postgresql

So, I'd like to do some random ordering when displaying data the code I have at this point is:
Timsheet.limit(1).offset(RANDOM(Timesheet.count)).first
I know that postgresql's (RANDOM) syntax is different than MYSQL's (RAND()) and Oracles (dbms_random.value) syntax.
I'd just like to confirm that my code is correct, from what I understand it's doing is, it's grabbing the first row, and offsetting the data in a random order?
Please help clear this up, thanks!
I think the following will work with all DBMS's
Timsheet.offset(Random.new.rand(Timsheet.count)).first

Order not working correctly in MDX

I'm new to MDX and I cannot get the ordering correct. I looked at references online and I think i sorted the query correctly, but the result of the query doesn't agree with me. Can anyone shed some light into what I'm not doing.
I have included a hypothetical example that is close to my problem.
The result of the query comes out without being sorted.
Any help is deeply appreciated.
Thanks
The 2nd argument to the Order()-function on your Rows-axis, must be the value or string to sort by. If you want to sort by the names of the SalespersonID-members, do something like this:
Order([Sales].[SalespersonID], [Sales].CURRENTMEMBER.MEMBER_NAME) on Rows

How to sql-recursive statements work?

I am trying to understand sql recursive statements, but it is really hard for me. For example:
Thats an exampe I am trying to understand and to write down the output.
Can sb pls explain me how this works, step by step?
greetings and thx in advance
maya
Also, see here - http://www.postgresql.org/docs/8.4/static/queries-with.html, where the steps of the recursive query evaluation are described.
The UNION ALL portion gets recursed until it returns no more records. I don't know if you can have multiple UNION ALL portions.

randomize drupal database query

I'm executing a query which I want to randomize query results from a drupal database.
here's what I have done...
$res=db_query("SELECT DISTINCT nid FROM content_type_event ORDER BY RANDOM()");
but this query doesn't work. what's wrong with this query? please help me to solve this?
Thanks a lot...
You probably need to be using ORDER BY RAND() instead.
Also there is a bit you may want to know about ORDER BY RAND()'s performance if you are getting a considerable amount of results that will be randomized:
http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/
EDIT: Just saw your comment that you are using PostgreSQL, this looks like it could be helpful: http://www.petefreitag.com/item/466.cfm
Sorry I can't be a lot of much help, I don't use PostgreSQL myself
You did not tell us which database engine you are using, but maybe ORDER BY RAND() would be better.
Update: okay, PostgreSQL uses RANDOM() and not RAND() so that's okay. I've found this question which seems to suggest that ORDER BY RANDOM() should work and the error is likely to be elsewhere. Maybe it's DISTINCT that is screwing things up; try your query again without DISTINCT.

SQL sp_help_operator

Anyone know what group I need to belong to show up in the sp_help_operator list?
Judging from the docs for sp_help_operator, it looks like you need to explicitly add/remove operators using sp_add_operator and sp_delete_operator.
http://msdn.microsoft.com/en-us/library/aa238703(SQL.80).aspx