An SQL statement for Mysql database required
£10-20 GBP
货到付款
Two mysql tables: Part, Part Association
Part attributes: id, name, type
Part Association attributes: child_part_id, parent_part_id
(i.e. Part has two one-to-many relationships with Part Association)
Sample values:-
Part: [id, type] 1,A; 2,A; 3,A; 4,A; 5,A; 6,B; 7,B; 8,B; 9,C; 10,C; 11,D.
Part Association: [child_part_id, parent_part_id] 1,6; 2,9; 3,6; 3,9; 4,7; 5,11; 7,9; 10,1; 10,5.
I want sql to return all parts which are of a specific type ($firsttype) but which are not related to another part which is of another specified type ($secondtype).
Example (1), for: $firsttype='A', $secondtype='B'
Result should be Part id's: 2, 5.
That is parts 2 and 5 are of type 'A' but are not related to any part of type B.
Example (2), for: $firsttype='A', $secondtype='C'
Result should be Part id's: 1, 4, 5.
That is parts 1, 4 and 5 are of type 'A' but are not related to any part of type C.
Example (3), for: $firsttype='B', $secondtype='C'
Result should be Part id's: 6, 8.
That is parts 6 and 8 are of type 'B' but are not related to any part of type C.
项目ID: #30567041
关于项目
授予:
Hi there, I am PHP web developer having worked with SQL databases. I can perform this task. Let me know if you are interested. Thanks.
有3名威客正在参与此工作的竞标,均价£15/小时
Hello, I am an expert in MySql with an experience of 7+ years in it. I can solve your database error after discussing with you start work on it. Looking forward to discuss with you in detail and start work on it. Th 更多
Hello. Thanks for your posting. My focus point is to give best results which is above the clients expectation. I am a professional engineer with 8+ years experiences SQL I am a skilled programmer who able to learn and 更多