Join is used to bring data from other tables than the base table (the main table used in query).
For ex: you have a table Employees with Emp_Id, Name, Job_Title columns. Other table is UserPWD with Emp_Id, User_Name, Password columns. Now you want to display Name, Job_Title, User_Name and Password for each user. Your SELECT stmt would be:
Select Name, Job_Title, User_Name, Password from Employees, UserPWD where Employees.Emp_Id = UserPWD.Emp_Id;
In essence:
Include required columns from required tables. If the column is in more that one table, use table.column for clarity.
In WHERE Clause, you use the join to specify the relationship.
Syntax: Select a.col, b.col from table1 a, table2 b
where a.col = b.col
You can use aliases for tablenames like shown above.
From your description, it looks like you are using only one table. Then you dont need a join.
2006-07-31 21:32:25
·
answer #1
·
answered by Indian_Male 4
·
4⤊
2⤋
i know one thing clearly,
username and passoword comes as a one column ---------------you expect like this
if you expect like this use the below query
SELECT username||' '||password FROM UserPassword WHERE username ='"&txtUserName.text&"'"
generally JOIN are used in select statment for combining more than one table.
Differenct type of JOIN's are there
(1)OUTER join
(2)INNER join
2006-07-31 22:42:05
·
answer #2
·
answered by publicguest 2
·
0⤊
0⤋
A JOIN statement is used to "join" data from two tables. It is not required when you need data only from one table. Do you have 1 table or 2 ?
An example of a join is
Assume tables employee (empno, ename, salary, dt of joining,deptno)
department(deptno, deptname)
SELECT ename, deptname
FROM employee, department
WHERE employee.deptno = department.deptno
SELECT ename, deptname
FROM employee INNER JOIN department ON (employee.deptno,department.deptno)
The query you want is
SELECT username, password
FROM UserPassword
WHERE username="&txtUserName.text&"
2006-07-31 21:33:51
·
answer #3
·
answered by sj 2
·
0⤊
0⤋
Agree with Indian_Male!
See: http://www.w3schools.com/sql/sql_join.asp
2006-07-31 21:34:41
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋
hopefully your 2 tables have a first key and overseas key constraint set up. once you do this... you could do merely. choose Table1.textual content, Table2.UserName FROM Table1 inner connect Table2 ON Table1.UserID = Table2.UserID
2016-11-27 05:33:32
·
answer #5
·
answered by ? 4
·
0⤊
0⤋