Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
feejaz
Yak Posting Veteran
68 Posts |
Posted - 2008-01-26 : 03:42:40
|
| Hi,I have two tablesClass FacultyFacultyID, ClassID FacultyID, BooksIDI want to get all rows of BooksID in class table using FacultyID of faculty table.ThanksNavi |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-26 : 04:26:01
|
[code]SELECT *FROM Class c INNER JOIN Faculty fON c.FacultyID = f.FacultyID[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
feejaz
Yak Posting Veteran
68 Posts |
Posted - 2008-01-26 : 04:39:32
|
| Thanks,I want to get Data of BooksID from "Faculty" compairing FacultyIDthere is no name of BooksID.Navi |
 |
|
|
feejaz
Yak Posting Veteran
68 Posts |
Posted - 2008-01-26 : 04:48:45
|
| Hi,I think I cannot convey my Question.I want to update Table "Class" column name "BooksID" by comparing Table "Faculty""Faculty" have fields name "FacultyID", BooksID,"Class" have fields name "ClassID" FacultyID, BooksID,(BooksID I just created now therefore there is no data in in the column)I want to get Data in the BooksID by using FacultyID.Navi |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-26 : 07:25:26
|
maybe you can post your table structure, sample data and expected output KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-26 : 08:33:23
|
quote: Originally posted by feejaz Hi,I think I cannot convey my Question.I want to update Table "Class" column name "BooksID" by comparing Table "Faculty""Faculty" have fields name "FacultyID", BooksID,"Class" have fields name "ClassID" FacultyID, BooksID,(BooksID I just created now therefore there is no data in in the column)I want to get Data in the BooksID by using FacultyID.Navi
UPDATE cSET c.BooksID=f.BooksIDFROM Class cINNER JOIN Faculty fON f.FacultyID=c.FacultyID |
 |
|
|
feejaz
Yak Posting Veteran
68 Posts |
Posted - 2008-01-28 : 02:08:58
|
| Thanks visakh16,Thats update mu table. But can u tell me How can we add more rows in the "class" table.In "class" table every SchoolID have 1 or 2 classID. Whereas in "Faculty" every facultyID have more than 3 SchoolID.Therefore when I update the table it only update the rows not entering new rows as per schoolID.Can you tell me how can we add new rows.ThanksNavi |
 |
|
|
|
|
|
|
|