Guest carly494 Posted March 29, 2007 Share Posted March 29, 2007 I am trying to query 6 tables at the same time, my manager is off so I have nobody to ask for help!! My tables and fields are: The numbers are the fields I can link them together with T - stockdet f - std_code (1) f - std_desc f - std_dep f - std_lcost f - std_rprice f - std_defman (2) T - branchcat f - branch (3) f - category (4) f - cattype f - minstock f - maxstock T - branchstock f - bstk_branch(3) f - bstk_stocklevel f - bstk_onorder T - supplier f - man_code(2) f - man_name T - pchange f - p_type f - p_code(1) f - p_band (4) T - branch f - branch(3) f - name If I run the below query I just get 'You have an error in you SQL syntax' select std_code , std_desc , std_dep , std_lcost , std_rprice , man_name , minstock , maxstock, lpad(bstk_branch,4,'0') , bstk_stocklevel , bstk_onorder , branch.name , p_band from stockdet left outer join supplier on man_code = std_defman left outer join pchange on p_code = std_code left outer join branchcat on category = p_band left outer join branch on lpad(BRANCH.branch,4,'0') = lpad(bstk_branch,4,'0') left outer join branchstock on lpad(bstk_branch,4,'0') = lpad(BRANCHcat.branch,4,'0' where P_type = 'C' Any help on this would be fantastic, I realise this may be a totally dumb question but I am new to SQL and as I said my manager is off today and there's nobody at work who can help. Thanks Quote Link to comment Share on other sites More sharing options...
Guest carly494 Posted March 29, 2007 Share Posted March 29, 2007 Im using MYSQL Control Center 0.9.4 if thats any help Quote Link to comment Share on other sites More sharing options...
fenway Posted April 4, 2007 Share Posted April 4, 2007 Well, you should make sure you use table prefixes, and you may want to consider column aliases too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.