"SELECT tbl1.staff_ic, tbl1.staff_name, tbl2.dec_status,tbl4.location,
					tbl3.post,tbl3.grade			
					FROM staff_detail tbl1
					INNER JOIN staff_declare tbl2
					ON tbl1.staff_ic = tbl2.staff_ic
					INNER JOIN staff_post tbl3
					ON tbl1.staff_post = tbl3.num
					INNER JOIN staff_department tbl4
					ON tbl1.staff_dep = tbl4.no
					";

isn`t my coding is right?? why when i execute my command just certain data are appear and the rest not appear

Recommended Answers

All 2 Replies

Member Avatar for spthorn

The INNER JOIN will only display data found in both the joined tables. Perhaps your staff_declare, staff_post and staff_department are sparse?

Can you clarify the "certain data"? Read all about JOINs at MySQL Manual.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.