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 |
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-22 : 04:35:06
|
| I have two tables in my SQL db. One called wce_contact and the other called wce_history.Would i be able to create a lookup looking like this:select website from wce_contact where notes not null in wce_historyhope that makes sense. Im trying to find the websites in the db that dont have notes, but the website field is in one table and the notes field is in the otherJT |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-22 : 04:40:45
|
| [code]select website from wce_contact cleft join wce_history hon h.linkingcol=c.linkingcolwhere h.notes is null[/code] |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-22 : 06:27:03
|
| Msg 207, Level 16, State 1, Line 3Invalid column name 'linkingcol'.Msg 207, Level 16, State 1, Line 3Invalid column name 'linkingcol'.whats up?JT |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-22 : 06:29:44
|
quote: Originally posted by Topaz Msg 207, Level 16, State 1, Line 3Invalid column name 'linkingcol'.Msg 207, Level 16, State 1, Line 3Invalid column name 'linkingcol'.whats up?JT
i gave generalised name becuse i dont know what columns by which tables are linked. replace it by your actual column names in your tables. |
 |
|
|
Leo_Don
Starting Member
42 Posts |
Posted - 2008-10-22 : 06:34:21
|
quote: Originally posted by Topaz I have two tables in my SQL db. One called wce_contact and the other called wce_history.Would i be able to create a lookup looking like this:select website from wce_contact where notes not null in wce_historyhope that makes sense. Im trying to find the websites in the db that dont have notes, but the website field is in one table and the notes field is in the otherJT
select website from wce_contact, wce_historywhere wce_history.notes <> null |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-22 : 06:39:18
|
quote: Originally posted by Leo_Don
quote: Originally posted by Topaz I have two tables in my SQL db. One called wce_contact and the other called wce_history.Would i be able to create a lookup looking like this:select website from wce_contact where notes not null in wce_historyhope that makes sense. Im trying to find the websites in the db that dont have notes, but the website field is in one table and the notes field is in the otherJT
select website from wce_contact, wce_historywhere wce_history.notes <> null
I get this from the latest queryMsg 306, Level 16, State 1, Line 1The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.JT |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-22 : 06:45:05
|
quote: Originally posted by Topaz
quote: Originally posted by Leo_Don
quote: Originally posted by Topaz I have two tables in my SQL db. One called wce_contact and the other called wce_history.Would i be able to create a lookup looking like this:select website from wce_contact where notes not null in wce_historyhope that makes sense. Im trying to find the websites in the db that dont have notes, but the website field is in one table and the notes field is in the otherJT
select website from wce_contact, wce_historywhere wce_history.notes <> null
I get this from the latest queryMsg 306, Level 16, State 1, Line 1The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.JT
then try casting it to varchar(max) |
 |
|
|
|
|
|
|
|