Is it possible for me to alias a column with data from another table and sorting it using a direct SQL statement.
Example:
[tt]
Table: diagnosis
+--------+--------------------------------------+
| name | diag |
+--------+--------------------------------------+
| Jack | severe back sprain at right shoulder |
| David | back pain at 5th vertebrae. |
+--------+--------------------------------------+
Table: aliases
+-------------+-------------+
| generalTerm | translate |
+-------------+-------------+
| backache | back pain |
| backache | back sprain |
+-------------+-------------+
[/tt]
Ultimately, I would like to get output like below ordered by diag:
[tt]
+--------+----------+
| name | diag |
+--------+----------+
| Jack | backache |
| David | backache |
+--------+----------+
[/tt]
--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
Example:
[tt]
Table: diagnosis
+--------+--------------------------------------+
| name | diag |
+--------+--------------------------------------+
| Jack | severe back sprain at right shoulder |
| David | back pain at 5th vertebrae. |
+--------+--------------------------------------+
Table: aliases
+-------------+-------------+
| generalTerm | translate |
+-------------+-------------+
| backache | back pain |
| backache | back sprain |
+-------------+-------------+
[/tt]
Ultimately, I would like to get output like below ordered by diag:
[tt]
+--------+----------+
| name | diag |
+--------+----------+
| Jack | backache |
| David | backache |
+--------+----------+
[/tt]
--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--