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 |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-04-11 : 03:44:41
|
problem is to handle relation between table,view and parameter for ongoing test.I want ProID,ProDescription from samplePro table,the ProID need to different from ProID in view(vw_temppro),then userid in vw_temppro must same the parameter brought from previous page.This is my query:"select ProID,ProblemDescription,ProblemResolution from dbo.samplePro where proid not in(select proid from dbo.vw_temppro) and uid=" + useridI've got error :Invalid columnname uidAny help!!!!!! |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-11 : 04:35:57
|
Is the column name uid or userid? Post the definition of samplePro table.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-04-11 : 04:45:32
|
samplePro(ProID,ProblemDescription,ProblemResolution)this is view:CREATE VIEW dbo.vw_tempproASSELECT dbo.TempAns.UserID AS uid, dbo.samplePro.ProID AS proid, dbo.TempAns.ProblemAnswer AS proansw, dbo.TempAns.Chk, dbo.sampleUser.UserName AS uname, dbo.samplePro.ProblemDescription AS prodescFROM dbo.TempAns INNER JOIN dbo.samplePro ON dbo.TempAns.ProblemID = dbo.samplePro.ProID INNER JOIN dbo.sampleUser ON dbo.TempAns.UserID = dbo.sampleUser.UserID |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-11 : 04:53:02
|
I see that uid column belongs to vw_temppro and not samplePro table. So the query should be like:"select ProID,ProblemDescription,ProblemResolution from dbo.samplePro where proid not in(select proid from dbo.vw_temppro where uid=" + userid + ")" Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-04-11 : 05:01:00
|
with ur query,i've got error:"Incorrect syntax near the keyword 'and'" |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-11 : 05:05:12
|
Please see corrected post.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-04-11 : 05:14:59
|
Thanks Harsh,now works well. |
 |
|
|
|
|
|
|