Prepare for your Next Interview
This is a discussion on problem in select statement within the MY SQL forums, part of the Databases category; i want to retrieve data from two tables,but in single row i want these. suppose there r two tables,in which deptid are foreignkey,where deptid=10,i want ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
i want to retrieve data from two tables,but in single row i want these.
suppose there r two tables,in which deptid are foreignkey,where deptid=10,i want one name from table,& where deptid=20,I want another name,please verify this."urjent" |
| Sponsored Links |
|
|||
|
Re: problem in select statement
select a.column1, b. column2 from table1 a , table2 b whre a.depid = 20
you can include as many columns you want considering table1 as a , and table 2 as b.. just add the column names as in table... |
|
|||
|
Re: problem in select statement
I guess this should help
Select a.deptid, b.deptid, b.name from table1 a, table2 b where a.deptid = b.deptid and b.deptid = 20 or b.deptid = 10 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is this a correct statement | anoop4real | C and C++ | 13 | 05-22-2008 06:22 AM |
| Why we have to close connection, statement, prepared statement | Geek_Guest | Java | 8 | 02-27-2008 06:09 AM |
| Can Select statement be used along with Update statement? | pankit | SQL | 2 | 01-10-2008 05:30 AM |
| Select within select | neeraj_sigh | SQL | 7 | 12-09-2007 03:59 AM |
| Evaluate SQL statement | Geek_Guest | Oracle | 1 | 09-30-2007 06:04 AM |