Click here to Skip to main content
15,886,799 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL TABLE JOIN Pin
wonder-FOOL18-Nov-11 11:00
wonder-FOOL18-Nov-11 11:00 
GeneralRe: SQL TABLE JOIN Pin
phome25-Nov-11 23:33
phome25-Nov-11 23:33 
AnswerRe: SQL TABLE JOIN Pin
Blue_Boy19-Nov-11 6:07
Blue_Boy19-Nov-11 6:07 
GeneralRe: SQL TABLE JOIN Pin
loyal ginger19-Nov-11 10:11
loyal ginger19-Nov-11 10:11 
GeneralRe: SQL TABLE JOIN Pin
SilimSayo19-Nov-11 11:24
SilimSayo19-Nov-11 11:24 
GeneralRe: SQL TABLE JOIN Pin
Pete O'Hanlon21-Nov-11 9:38
mvePete O'Hanlon21-Nov-11 9:38 
AnswerRe: SQL TABLE JOIN Pin
Naunt21-Nov-11 14:31
Naunt21-Nov-11 14:31 
AnswerRe: SQL TABLE JOIN Pin
Niladri_Biswas30-Nov-11 17:03
Niladri_Biswas30-Nov-11 17:03 
Try

'c' + c.ID =  co.CID 


and not
c.ID = 'c' + co.CID


If C.Id is of integer type then cast it

'c' + Cast(c.ID as varchar(20))=  co.CID


Try this

Declare @City table (Id int,Name Varchar(20))
Insert Into @City
Select 123,'City1' Union All Select 1,'City2' Union ALl Select 124,'City3' Union ALl Select 5,'City4'


Declare @Country table (Id int,CID Varchar(10),Name Varchar(20))
Insert Into @Country 
Select 1,'c123','Country 1' Union All
Select 1,'1','Country 1' Union All
Select 1,'c5','Country 1'

SELECT c.Name, co.Name
FROM @City C
JOIN @Country co ON 'c' + Cast(c.ID as varchar(20))=  co.CID


Hope this helps
Niladri Biswas

QuestionSQLite in-memory database - Loading sqlite db as memory db Pin
Prathapachandran18-Nov-11 2:18
professionalPrathapachandran18-Nov-11 2:18 
AnswerRe: SQLite in-memory database - Loading sqlite db as memory db Pin
André Kraak18-Nov-11 2:21
André Kraak18-Nov-11 2:21 
GeneralRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Prathapachandran18-Nov-11 2:32
professionalPrathapachandran18-Nov-11 2:32 
AnswerRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Luc Pattyn18-Nov-11 3:14
sitebuilderLuc Pattyn18-Nov-11 3:14 
GeneralRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Prathapachandran18-Nov-11 3:32
professionalPrathapachandran18-Nov-11 3:32 
AnswerRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Luc Pattyn18-Nov-11 4:18
sitebuilderLuc Pattyn18-Nov-11 4:18 
GeneralRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Prathapachandran19-Nov-11 4:02
professionalPrathapachandran19-Nov-11 4:02 
AnswerRe: SQLite in-memory database - Loading sqlite db as memory db Pin
jschell18-Nov-11 10:48
jschell18-Nov-11 10:48 
GeneralRe: SQLite in-memory database - Loading sqlite db as memory db Pin
Prathapachandran19-Nov-11 3:30
professionalPrathapachandran19-Nov-11 3:30 
GeneralRe: SQLite in-memory database - Loading sqlite db as memory db Pin
jschell25-Nov-11 8:35
jschell25-Nov-11 8:35 
QuestionSelf-join to return either/or results? Pin
AHSTech17-Nov-11 6:12
AHSTech17-Nov-11 6:12 
AnswerRe: Self-join to return either/or results? Pin
David Mujica17-Nov-11 6:17
David Mujica17-Nov-11 6:17 
GeneralRe: Self-join to return either/or results? Pin
AHSTech17-Nov-11 7:14
AHSTech17-Nov-11 7:14 
AnswerRe: Self-join to return either/or results? Pin
SilimSayo18-Nov-11 4:53
SilimSayo18-Nov-11 4:53 
AnswerRe: Self-join to return either/or results? Pin
Chris Meech18-Nov-11 6:13
Chris Meech18-Nov-11 6:13 
GeneralRe: Self-join to return either/or results? Pin
SilimSayo18-Nov-11 6:53
SilimSayo18-Nov-11 6:53 
GeneralRe: Self-join to return either/or results? Pin
Chris Meech18-Nov-11 7:46
Chris Meech18-Nov-11 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.