Well here is my first problem, which is the biggest reason I can't seem to understand SQL Server or dataases in general.
To have a realtional database you set up tables with foriegn keys and primary keys referenceing the id's like product table has a product name and one of the columns is a user_id displaying the id number of the user in the user table. From what I can tell you are supposed to set up the user_id in the products table a foriegn key to the Primary Key in the user table. I may be totally wrong on this though.
Now my biggest question is how do you retrive this information the proper way to get it ready to be displayed in a gridveiw or a datalist?
I have been reading SQL Server 2005 for developers and reading online tutorials and it seems like they say you need to set up a relationship and because of the realtionship you don't need to do a join, but I never hear how to use the relationship at all.
Please someone help I am so totally lost that i feel like i will never understand. I have spent the last week trying to figure this out and I guess I am just googleing this wrong completely or i am incompentent one of the two.
Thank you.
try this
select a.column1, a.column2 ... b.column1, b.column2
from user a inner join product b on a.userID = b.userID
Hope this help.
No comments:
Post a Comment