Member Avatar for සශික

Recently I tried many ways to retrive two columns from database.
First I'll explain my database structure:

Module Table
mod_id,name,year,semester

Lesson Table
less_id,name,location,mod_id,year,semester,faculty

I want to retrive mod_id,name from module table.
I used this select query to do that :

select md.mod_id as 'mdid',md.name as 'nme' from module md,lesson ls where md.mod_id=ls.mod_id and ls.semester='1' and ls.faculty='School of Computing' and ls.year='1'
Result is like this:
mdid|nme
105| c#
105| c#

But results should be

mdid| nme
101| CA
105| c#

please help me to correct this wrong. I'm stucked....

I want to retrive mod_id,name from module table

SELECT mod_id, name FROM Module
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.