bold this called alias of the able, if table name is long then you can give short name and based on short name you can acess the table details, if you wants to do the seft join then alias is more useful
Like
Select EM.EmployeeID, EM.EmployeeName, M.EmployeeName as ManagerName From EmployeeMaster EM INNER JOIN EmployeeMaster M ON M.EmployeeID = EM.ManagerID
let me know if any query
Thanks,
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer
Marked as answer by Hunain Hafeez on Nov 17, 2012 11:43 AM
that if u look at above query which i marked as Answer to my orginal question ,
then plz have a look at AND email= '123@yahoo.com', so i am confused that even i am not selection email column from tblUser explicitly then how it is accessing that column ? confused
Hunain Hafee...
Member
238 Points
639 Posts
accessing records from sql server via asp.net 3.5
Nov 17, 2012 10:48 AM|LINK
i am using asp.net 3.5 and trying to run this query to select records from data base sqlserver 2008 , help ,
i have two tables , tblUser , tblJobAdv
tblUser: tblJobAdv
user id (pk) advId
email date
address userId(F.K)
Now i want to select all columns from tblJobAdv for only those userid's for which email = '123@yahoo.com' , in tblUser,
i did my best but spent 4 hours and couldn't achieve anything , Help !
dhol.gaurav
Contributor
3998 Points
725 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 10:55 AM|LINK
Hello
Check below query
Select tbj.* from tblJobAdv tbj INNER JOIN tblUser tbU ON tbj.UserID = tbU.UserID And email = '123@yahoo.com'
you need to refere join in SQL, check below link for more about joins
http://www.w3schools.com/sql/sql_join.asp
let me know if any query
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer
Hunain Hafee...
Member
238 Points
639 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:02 AM|LINK
wowww , thanks alot man , it worked like a charm ,
but still wondering that what does these bolded terms mean in ur query and how to use it, plz tel me in details and thanks alot !
dhol.gaurav
Contributor
3998 Points
725 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:11 AM|LINK
Hey,
bold this called alias of the able, if table name is long then you can give short name and based on short name you can acess the table details, if you wants to do the seft join then alias is more useful
Like
Select EM.EmployeeID, EM.EmployeeName, M.EmployeeName as ManagerName From EmployeeMaster EM INNER JOIN EmployeeMaster M ON M.EmployeeID = EM.ManagerID
let me know if any query
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer
Hunain Hafee...
Member
238 Points
639 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:27 AM|LINK
dhol.gaurav
Contributor
3998 Points
725 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:30 AM|LINK
Here tbj alias of tblJobAdv and * means select all columns of that that table
let me know of any query
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer
Hunain Hafee...
Member
238 Points
639 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:48 AM|LINK
one last question,
that if u look at above query which i marked as Answer to my orginal question ,
then plz have a look at AND email= '123@yahoo.com', so i am confused that even i am not selection email column from tblUser explicitly then how it is accessing that column ? confused
dhol.gaurav
Contributor
3998 Points
725 Posts
Re: accessing records from sql server via asp.net 3.5
Nov 17, 2012 11:54 AM|LINK
That Query is built using SQL joins, so weather you select column or not you can access any column in where condiction from both of the table.
SQL Joins is a very much usfull in any of the SQL Query
let me know if any query
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer