|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Query Help - Using Inner Joins
I am trying to create a query which uses Inner Join.
The following 2 queries work by themselves, but I need to make them work in 1 query. ==Query 1== SELECT * FROM tbl_property INNER JOIN tbl_cat_one_feat_eight_bet ON tbl_property.prop_ID = tbl_cat_one_feat_eight_bet.prop_ID WHERE cat_one_feat_eight_ID = 'c1f8_101' ==Query 2== SELECT * FROM tbl_property INNER JOIN tbl_cat_two_feat_six_bet ON tbl_property.prop_ID = tbl_cat_two_feat_six_bet.prop_ID WHERE cat_two_feat_six_ID = 'c2f6_101' ========= I tried using UNION and UNION ALL, but it would not work properly Any help trying to put these 2 queries together would be appreciated. Thank you ![]() |
|
#2
|
|||
|
|||
|
Have you tried merging them with ()? For example
Code:
SELECT * FROM (tbl_property INNER JOIN tbl_cat_one_feat_eight_bet ON tbl_property.prop_ID = tbl_cat_one_feat_eight_bet.prop_ID) INNER JOIN tbl_cat_two_feat_six_bet ON tbl_property.prop_ID = tbl_cat_two_feat_six_bet.prop_ID WHERE cat_one_feat_eight_ID = 'c1f8_101' |
|
#3
|
|||
|
|||
|
A union will only work if there are the same number of columns in both queries with the same column name.
As an aside, you can see if the help found in this forum works for you, but be aware that this forum is really for ColdFusion. Devshed has numerous other forums devoted specifically to SQL and database development. You'd probably get much better luck in one of those.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Query Help - Using Inner Joins |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|