Click here to Skip to main content
16,004,782 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to join two tables Pin
Michael Sync4-Jul-07 18:49
Michael Sync4-Jul-07 18:49 
QuestionHow can I call a DB2 system procedure GET_DBSIZE_INFO by .net? Pin
Jameson_cn4-Jul-07 17:54
Jameson_cn4-Jul-07 17:54 
Questionproblem with GetChanges [modified] Pin
goldoche4-Jul-07 9:14
goldoche4-Jul-07 9:14 
AnswerRe: problem with GetChanges Pin
goldoche4-Jul-07 10:38
goldoche4-Jul-07 10:38 
QuestionUsing a DataSet to insert data in a table througth a sproc Pin
Le centriste4-Jul-07 4:35
Le centriste4-Jul-07 4:35 
AnswerRe: Using a DataSet to insert data in a table througth a sproc Pin
goldoche4-Jul-07 9:46
goldoche4-Jul-07 9:46 
QuestionSQL query... need help Pin
Diana18114-Jul-07 4:02
Diana18114-Jul-07 4:02 
AnswerRe: SQL query... need help Pin
andyharman4-Jul-07 9:00
professionalandyharman4-Jul-07 9:00 
Hi Diana

Sounds like homework - so I'll try to walk you through the solution, rather than just give it to you on a plate:

The way that I would approach this would be to build a select statement that returns all of the "Authors" who reside in Tasmania (you will need to join between 3 tables).

I would then substitute that select statement into the from-clause of the following:
select distinct Academic.AcNum, Academic.GiveName, Academic.FamName,
      Academic.DeptNum
   from (
      --Your tasmanian-authors select statement goes here.
      select TasmanianAuthor.PaNum, TasmanianAuthor.AcNum
      from Author as TasmanianAuthor
      inner join ...
      where ...
   ) X
   inner join Author
      on Author.PaNum = X.PaNum
      and Author.AcNum <> X.AcNum
   inner join Academic
      on Academic.AcNum = Author.AcNum
   order by Academic.AcNum
I know that embedding a select-statement within a from-clause is supported by at-least SQL-Server, Oracle, and DB2. If your database doesn't support this technique then try looking-up "correlated sub-queries" to find a possible alternative way of achieving the same result.

The "distinct" clause will be required where an academic has authored several papers, or if a paper has been authored by more than 2 academics.

If you want to learn more about SQL programming (and you should because SQL allows you to do some reeeeally powerful stuff) then there are plenty of good articles on the web or books in the bookshops. My own favorite is Joe Celko's SQL for Smarties.

Hope that helps.
Andy
GeneralRe: SQL query... need help Pin
Diana18114-Jul-07 17:28
Diana18114-Jul-07 17:28 
GeneralRe: SQL query... need help Pin
Pete O'Hanlon4-Jul-07 22:29
mvePete O'Hanlon4-Jul-07 22:29 
AnswerRe: SQL query... need help Pin
andyharman4-Jul-07 22:46
professionalandyharman4-Jul-07 22:46 
GeneralRe: SQL query... need help Pin
Diana18116-Jul-07 0:39
Diana18116-Jul-07 0:39 
GeneralFunny with SELECT ... INTO Pin
Brady Kelly3-Jul-07 23:58
Brady Kelly3-Jul-07 23:58 
GeneralRe: Funny with SELECT ... INTO Pin
andyharman4-Jul-07 1:22
professionalandyharman4-Jul-07 1:22 
GeneralRe: Funny with SELECT ... INTO Pin
Mike Dimmick4-Jul-07 3:31
Mike Dimmick4-Jul-07 3:31 
QuestionRunning a SQL Script file using C# Pin
wasife3-Jul-07 19:25
wasife3-Jul-07 19:25 
AnswerRe: Running a SQL Script file using C# Pin
Colin Angus Mackay3-Jul-07 22:44
Colin Angus Mackay3-Jul-07 22:44 
GeneralRe: Running a SQL Script file using C# Pin
N a v a n e e t h4-Jul-07 3:33
N a v a n e e t h4-Jul-07 3:33 
GeneralRe: Running a SQL Script file using C# Pin
Colin Angus Mackay4-Jul-07 7:00
Colin Angus Mackay4-Jul-07 7:00 
GeneralRe: Running a SQL Script file using C# Pin
N a v a n e e t h4-Jul-07 18:20
N a v a n e e t h4-Jul-07 18:20 
GeneralRe: Running a SQL Script file using C# Pin
Colin Angus Mackay4-Jul-07 21:26
Colin Angus Mackay4-Jul-07 21:26 
QuestionColumn info in SQL Server 2005 Pin
I.explore.code3-Jul-07 18:39
I.explore.code3-Jul-07 18:39 
AnswerRe: Column info in SQL Server 2005 Pin
Tirthadip3-Jul-07 20:43
Tirthadip3-Jul-07 20:43 
QuestionDataTable Question using VB.NET Pin
HurricaneDan3-Jul-07 9:14
HurricaneDan3-Jul-07 9:14 
AnswerRe: DataTable Question using VB.NET Pin
DanB19835-Jul-07 1:27
DanB19835-Jul-07 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.