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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need select query

Author  Topic 

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 17:06:23
I have a table tbl_user it have a column cse .It contains id's of another table (CSE_LIST) column name (cse) ..

Now how to select the list using the id in tbl_user By using login_name

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-09-30 : 17:13:41
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
[url]http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 17:18:19
select cse from cse_list where id=( select cse from tbl_user where login_name='wer')

and i got this error
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 17:21:05
Tbl_user

login_name | cse

wer |1,2,3,4

Table_cse
id |cse
1 |hai
2 |hello
3 |sample
4 |sample
5 |sample
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 17:22:10
By using the login_name i need to select the cse.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-09-30 : 17:49:37
Jafry-

There's enough overlap between this thread and http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=150930, it doesn't help to have 2 posts. Before you start a new thread be sure that the question/problem is substantially different from what you've posted recently.

And if you do create a new post, don't repeat the same question when updating an earlier post. It's very frustrating for everyone who's trying to help when they see the same questions multiple times. Which thread should we answer?

Thanks.
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 17:54:28
Sorry Robvolk ..This post is not clear to users so I tried to split my question to get the answer quickly..
Go to Top of Page

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-09-30 : 18:24:58
Please goto this link

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=150930
Go to Top of Page
   

- Advertisement -