I have two queries. Each of them works correctly by itself. I need to join the results.
I thought I might use SELECT AS to join the results. Here is the current mySQL syntax:
-----
SELECT * from new_alloys_added_by_users left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No AS NewAlloysAndRatings
SELECT *
FROM user_prefs_for_alloys
JOIN new_alloys_added_by_users ON user_prefs_for_alloys.Alloy_ID_No = new_alloys_added_by_users.Alloy_ID_No
WHERE (user_prefs_for_alloys.id = 1)
AND (user_prefs_for_alloys.Alloy_ID_No >0)
AS UserPrefsAndNewAlloys
SELECT *
from NewAlloysAndRatings JOIN UserPrefsAndNewAlloys on NewAlloysAndRatings.Alloy_ID_No = UserPrefsAndNewAlloys.Alloy_ID_No
-----
As I noted, the queries are working fine. I just need to find the correct way to join them. When I run this code, I get this error message:
> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near 'AS NewAlloysAndRatings' at line 1
How can I correct this? Thanks very much in advance to all for any info.
I thought I might use SELECT AS to join the results. Here is the current mySQL syntax:
-----
SELECT * from new_alloys_added_by_users left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No AS NewAlloysAndRatings
SELECT *
FROM user_prefs_for_alloys
JOIN new_alloys_added_by_users ON user_prefs_for_alloys.Alloy_ID_No = new_alloys_added_by_users.Alloy_ID_No
WHERE (user_prefs_for_alloys.id = 1)
AND (user_prefs_for_alloys.Alloy_ID_No >0)
AS UserPrefsAndNewAlloys
SELECT *
from NewAlloysAndRatings JOIN UserPrefsAndNewAlloys on NewAlloysAndRatings.Alloy_ID_No = UserPrefsAndNewAlloys.Alloy_ID_No
-----
As I noted, the queries are working fine. I just need to find the correct way to join them. When I run this code, I get this error message:
> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near 'AS NewAlloysAndRatings' at line 1
How can I correct this? Thanks very much in advance to all for any info.