Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Re: Help need on query


Message #1 by "Ken Schaefer" <ken@a...> on Fri, 1 Nov 2002 14:41:40 +1100
SELECT
    a.ArticleID,
    a.ArticleText
FROM
    Table1 AS a
WHERE NOT EXISTS
    (
    SELECT
        NULL
    FROM
        Table2 AS b
    WHERE
        b.ArticleID = a.ArticleID
    AND
        b.NSID = 1
    )

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ryan vd Merwe" <ryan@8...>
Subject: [asp_web_howto] Help need on query


: Hi
:
: My problem is as follows:
:
: I need to display the articles that are not listed in table 2. so for
example how do I display the articles that are not in table 2  where nsID=1
(how do i display articles 1 and 4)?
:
: hope this makes sense
: Table structure is below.
:
: table 1
:
:       Table1
:       articleID number
:       articleTitle text
:
:
: represented table 1 looks like
:
:       Table1
:       articleID articleTitle
:       1 Product launch
:       2 Latest sales fuigures
:       3 Annual Report
:       4 Year end function
:
:
:
: table 2
:
:       Table2
:       articleID number
:       nsID number
:
:
:
: represented table 2 looks like:
:       Table2
:       articleID nsID
:       2 1
:       3 1
:       4 2
:       2 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #2 by "Ryan vd Merwe" <ryan@8...> on Fri, 1 Nov 2002 10:42:14 +0200
Hi Ken

thanks for this query

I get a 'too few parameters, expected 1' error.I've checked all column and
table names and they are correct, what am i doing wrong?


----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Friday, November 01, 2002 5:41 AM
Subject: [asp_web_howto] Re: Help need on query


> SELECT
>     a.ArticleID,
>     a.ArticleText
> FROM
>     Table1 AS a
> WHERE NOT EXISTS
>     (
>     SELECT
>         NULL
>     FROM
>         Table2 AS b
>     WHERE
>         b.ArticleID = a.ArticleID
>     AND
>         b.NSID = 1
>     )
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Ryan vd Merwe" <ryan@8...>
> Subject: [asp_web_howto] Help need on query
>
>
> : Hi
> :
> : My problem is as follows:
> :
> : I need to display the articles that are not listed in table 2. so for
> example how do I display the articles that are not in table 2  where
nsID=1
> (how do i display articles 1 and 4)?
> :
> : hope this makes sense
> : Table structure is below.
> :
> : table 1
> :
> :       Table1
> :       articleID number
> :       articleTitle text
> :
> :
> : represented table 1 looks like
> :
> :       Table1
> :       articleID articleTitle
> :       1 Product launch
> :       2 Latest sales fuigures
> :       3 Annual Report
> :       4 Year end function
> :
> :
> :
> : table 2
> :
> :       Table2
> :       articleID number
> :       nsID number
> :
> :
> :
> : represented table 2 looks like:
> :       Table2
> :       articleID nsID
> :       2 1
> :       3 1
> :       4 2
> :       2 2
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20


  Return to Index