I've 3 tables:
- Parts:
Name
: internal name,Active
: bool - Languages: list of languages (English, French, German, ....)
- PartsTranslations:
RealName
and Id's of the other 2 tables.
I would like to get a list of Parts telling me the internal name
, active
status and how many translations are missing (total lang subtract translations made)
I made this SQL query that is giving me what I need (I don't know if this is the better way to make it or not, but it's working):
SELECT
parts1.name,
parts1.active,
(
(SELECT count(lang.id)
FROM languages AS lang)
-
(SELECT count(trans.id)
FROM parts AS parts2
INNER JOIN partstranslations as trans
ON parts2.id = trans.partid
WHERE parts2.id = parts1.id)
)
from parts as parts1;
1º question- How can I make this query using Castle ActiveRecord?
2º question- How's the performance of the final query (expensive one)?
Thanks