TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kishor choure
NA
87
46.1k
About sql query.
Jul 24 2012 9:11 AM
I have two tables personaltbl and coursetbl .
In both table p_id is common field column
I want to add record inside coursetbl if p_id value not present inside coursetbl but present inside the personaltbl.
But I am facing problem to check p_id value inside the personaltbl but same p_id value not present inside coursetbl. if this p_id value is not present inside the coursetbl then I want to insert record inside coursetbl.
For example:
personaltbl coursetbl
p_id int pk c_id int
p_name char c_name char
p_add char c_fees bigint
p_id Fk
some records
personaltbl coursetbl
p_id p_name p_add | c_id c_name c_add p_id
1 xyz abc | 1 qqqq yyyyy 1
3
pqr def | 2 eeee mmm 7
7 ert hgh |
Here p_id value 3 is present inside personaltbl but it absent in coursetbl . I want to insert record inside coursetbl having p_id value 3 by checking p_id value inside coursetbl.
shortly I want to insert record inside coursetbl by checking p_id value if present inside personaltbl but absent in coursetbl.
please suggest sql query or procedure or trigger or cursor. thank you.
Reply
Answers (
8
)
how to stop "exec master..xp_cmdshell bcp select" when cancel button click in c# windows application
How can i make query to filtering pages for particular user from many users pages using store procedure