Difference between revisions of "Need help with SQL"
imported>Denny (New page: {{pubdate|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, cau...) |
imported>Denny |
||
Line 3: | Line 3: | ||
Imagine I have following table (a triple store): | Imagine I have following table (a triple store): | ||
− | <table> | + | <table border="1"> |
<tr><th>Subject</th> <th>Predicate</th> <th>Object</th></tr> | <tr><th>Subject</th> <th>Predicate</th> <th>Object</th></tr> | ||
<tr><td>Adam</td> <td>yahoo im</td> <td>adam@net</td></tr> | <tr><td>Adam</td> <td>yahoo im</td> <td>adam@net</td></tr> | ||
Line 10: | Line 10: | ||
</table> | </table> | ||
How do I make a query that returns me the following table: | How do I make a query that returns me the following table: | ||
− | <table> | + | <table border="1"> |
<tr><th>Subject</th> <th>o1</th> <th>o2</th></tr> | <tr><th>Subject</th> <th>o1</th> <th>o2</th></tr> | ||
<tr><td>Adam</td> <td>adam@net</td> <td>adam</td></tr> | <tr><td>Adam</td> <td>adam@net</td> <td>adam</td></tr> |
Latest revision as of 17:13, 27 December 2007
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.