Need help with SQL

From Simia
Jump to navigation Jump to search
11 May 2006

But I have no time to write it down... I will sketch my problem, and hopefully get an answer (I've started this blog in the morning, and now I need to close it, cause I have to leave).

Imagine I have following table (a triple store):

Subject Predicate Object
Adam yahoo im adam@net
Adam skye adam
Berta skype berta

How do I make a query that returns me the following table:

Subject o1 o2
Adam adam@net adam
Berta - berta

The problems are the default value in the middle lower cell. The rest works (as maybe seen in the Semantic Mediawiki code, file includes/SMW_InlineQueries.php -- note that the CVS is not up to date for now, because SourceForge's CVS is down for days!)

It should work in general, with as many columns as I like on the answer table (based on the predicates in the first one).

Oh, and if you solved this -- or have an idea -- it would be nice if it worked with MySQL 4.0, i.e. without Subqueries.

Any ideas?

Originally published on Semantic Nodix

Previous post:
Semantic Web Summer School 2006
Following post:
Semantic Mediawiki 0.4 - Knowledge Inside!

Comments are still missing on this post.