Re: [2005] SQL Join question
vb Code:
sel = "SELECT * FROM USviews NATURAL JOIN USviewsDescription ON UV_SessionID = myInt"
Re: [2005] SQL Join question
I would say like this:
Select * From USviews Inner Join USviewsDesctionion On UV_SessionID Where UV_SessionID = " & myInt.ToString()
The myInt should be outside the string qoutes to allow the variables value to be used.
I would really like to see the database structure to eally help out though.
Re: [2005] SQL Join question
talkro, I got the following error message (although i moved the myInt outside the string as Gary suggested). I got the following error:
The multi-part identifier "USviews.UV_SessionID" could not be bound.
Gary, when I tried yours I got this message:
An expression of non-boolean type specified in a context where a condition is expected
I think I'm doing something badly wrong here although I've double checked the column names, values and datatypes, they are correct. I'll keep trying, thanks.
Re: [2005] SQL Join question
What are the database fields types? What is the actuall SQL being generalted? My main point is that myInt needs to outside the double qoutes.
Re: [2005] SQL Join question
You need to specify how the tables are joined in the ON clause. As far as I know that means you need to reference a column in both tables-not just one.
Instead of 'On UV_SessionID' I'd say 'ON USviews.UV_SessionID = USviewsDesctionion.UV_SessionID' assuming that both tables have the same column.