Click here to Skip to main content
15,890,527 members
Home / Discussions / Database
   

Database

 
GeneralRe: SELECT COUNT into a variable Pin
Christian Graus2-May-05 14:07
protectorChristian Graus2-May-05 14:07 
GeneralRe: SELECT COUNT into a variable Pin
Luis Alonso Ramos2-May-05 14:15
Luis Alonso Ramos2-May-05 14:15 
GeneralRe: SELECT COUNT into a variable Pin
Colin Angus Mackay2-May-05 20:03
Colin Angus Mackay2-May-05 20:03 
GeneralRe: SELECT COUNT into a variable Pin
Luis Alonso Ramos2-May-05 20:52
Luis Alonso Ramos2-May-05 20:52 
GeneralRe: SELECT COUNT into a variable Pin
Colin Angus Mackay2-May-05 22:32
Colin Angus Mackay2-May-05 22:32 
Generalinstall mysql Pin
Anonymous2-May-05 5:52
Anonymous2-May-05 5:52 
GeneralSimple JOIN in Access 2002 Pin
Larsenal1-May-05 13:30
Larsenal1-May-05 13:30 
GeneralRe: Simple JOIN in Access 2002 Pin
turbochimp2-May-05 2:35
turbochimp2-May-05 2:35 
Well, you haven't done anything clearly wrong in your database design, but your query needs some help. If you include a WHERE clause, only the rows that satisfy the condition will be listed, so LEFT JOINing won't help.

If it's really important to have the results indicate whether the album is linked to the selected article, this would probably do the trick:

SELECT <br />
    al.ID, <br />
    al.Title, <br />
    l.Article, <br />
    IIf([l].[Article] Is Not Null AND l.Article = [article ID],"Linked","Unlinked") AS IsLinked<br />
FROM <br />
    Album AS al LEFT JOIN linkArticleAlbum AS l <br />
      ON al.ID = l.Album;


Given your setup, where a single Album may be associated with many Articles, you should be aware that you may get multiple results for a single Album (from your example, Album 1 would appear twice in the results).

If you don't care about indicating in the results whether the Album is linked (i.e. you want to handle that in code) then the query is even shorter:

SELECT <br />
    al.ID, <br />
    al.Title, <br />
    l.Article<br />
FROM <br />
    Album AS al LEFT JOIN linkArticleAlbum AS l <br />
      ON al.ID = l.Album;


Hope this helps.

The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralRe: Simple JOIN in Access 2002 Pin
Larsenal2-May-05 8:00
Larsenal2-May-05 8:00 
QuestionHow to compare time Pin
Leelanga30-Apr-05 22:13
Leelanga30-Apr-05 22:13 
AnswerRe: How to compare time Pin
Alexey A Abramov3-May-05 9:09
Alexey A Abramov3-May-05 9:09 
GeneralRe: How to compare time Pin
Leelanga4-May-05 5:49
Leelanga4-May-05 5:49 
QuestionPossible to pass table as parametr to stored procedure??? Pin
_J_30-Apr-05 8:28
_J_30-Apr-05 8:28 
AnswerRe: Possible to pass table as parametr to stored procedure??? Pin
NewSilence30-Apr-05 18:52
NewSilence30-Apr-05 18:52 
GeneralRe: Possible to pass table as parametr to stored procedure??? Pin
_J_30-Apr-05 22:02
_J_30-Apr-05 22:02 
Questionhow to efficiently use dataset in large database? Pin
feyang30-Apr-05 2:24
feyang30-Apr-05 2:24 
AnswerRe: how to efficiently use dataset in large database? Pin
Colin Angus Mackay30-Apr-05 10:27
Colin Angus Mackay30-Apr-05 10:27 
GeneralBegineer 's questions:using ADO Pin
brilliant10129-Apr-05 20:40
brilliant10129-Apr-05 20:40 
GeneralSQL Query Problem. Pin
Asim N.29-Apr-05 16:23
Asim N.29-Apr-05 16:23 
GeneralRe: SQL Query Problem. Pin
Colin Angus Mackay30-Apr-05 0:48
Colin Angus Mackay30-Apr-05 0:48 
GeneralField change data type after detach and attach database to sql server Pin
Mekong River28-Apr-05 23:54
Mekong River28-Apr-05 23:54 
GeneralRe: Field change data type after detach and attach database to sql server Pin
Albert Pascual30-Apr-05 4:57
sitebuilderAlbert Pascual30-Apr-05 4:57 
GeneralRe: Field change data type after detach and attach database to sql server Pin
Mekong River30-Apr-05 19:40
Mekong River30-Apr-05 19:40 
GeneralInner Datagrid, date format Pin
mansir 12328-Apr-05 23:36
mansir 12328-Apr-05 23:36 
GeneralData Projects Pin
gantww28-Apr-05 10:44
gantww28-Apr-05 10:44 

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.