Home > Archive > FoxPro database connector > August 2005 > HELP with SELECT IN CLAUSE









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HELP with SELECT IN CLAUSE
John Cosmas

2005-06-15, 11:25 am

I need to execute a SELECT statement that has an IN clause; but it needs to
behave like NOT IN. My current statement looks like

SELECT * FROM Company WHERE Company.Name IN "A"

I need it to act like WHERE Company.Name NOT IN "A", so is this a valid
statement??


Jack Jackson

2005-06-15, 1:25 pm

On Wed, 15 Jun 2005 11:28:00 -0500, "John Cosmas"
<johncosmas@charter.net> wrote:

>I need to execute a SELECT statement that has an IN clause; but it needs to
>behave like NOT IN. My current statement looks like
>
>SELECT * FROM Company WHERE Company.Name IN "A"
>
>I need it to act like WHERE Company.Name NOT IN "A", so is this a valid
>statement??


The syntax of the IN clause is IN(<list of values> ), so your first
statement should be:
SELECT * FROM Company WHERE Company.Name IN("A").

If you have SET ANSI OFF, records whose name field begin with A will
be returned.

You can put NOT in front of the IN:

SELECT ... WHERE Company.Name NOT IN ("A")

To use more standard SQL you could use LIKE:

SELECT ... WHERE Company.Name LIKE "A%"

John Cosmas

2005-06-15, 1:25 pm

Thanks, Jack;

How do I run a SELECT COUNT(*) in code and pass the results into a variable?

John

"Jack Jackson" < jacknospam@pebblerid
ge.com> wrote in message
news:c3o0b1tmmmiecd4
789a465kcenno8od17h@
4ax.com...
> On Wed, 15 Jun 2005 11:28:00 -0500, "John Cosmas"
> <johncosmas@charter.net> wrote:
>
>
> The syntax of the IN clause is IN(<list of values> ), so your first
> statement should be:
> SELECT * FROM Company WHERE Company.Name IN("A").
>
> If you have SET ANSI OFF, records whose name field begin with A will
> be returned.
>
> You can put NOT in front of the IN:
>
> SELECT ... WHERE Company.Name NOT IN ("A")
>
> To use more standard SQL you could use LIKE:
>
> SELECT ... WHERE Company.Name LIKE "A%"
>



Fred Taylor

2005-06-15, 8:26 pm

You can either use COUNT FOR condition TO variable, or SELECT COUNT(*) FROM
table INTO ARRAY arrayname.

Arrayname element 1 would have the count in it.

--
Fred
Microsoft Visual FoxPro MVP


"John Cosmas" <johncosmas@charter.net> wrote in message
news:%FZre.689$uS2.2@fe03.lga...
> Thanks, Jack;
>
> How do I run a SELECT COUNT(*) in code and pass the results into a
> variable?
>
> John
>
> "Jack Jackson" < jacknospam@pebblerid
ge.com> wrote in message
> news:c3o0b1tmmmiecd4
789a465kcenno8od17h@
4ax.com...
>
>



newboy

2005-08-11, 7:24 am

you can also use the _tally variable to get the records count after you use
the SELECT or other SQL statment.
"Fred Taylor" <ftaylor@mvps.org!REMOVE> 写入消息新闻
:#vA9r8gcFHA.1040@TK2MSFTNGP10.phx.gbl...
> You can either use COUNT FOR condition TO variable, or SELECT COUNT(*)

FROM
> table INTO ARRAY arrayname.
>
> Arrayname element 1 would have the count in it.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "John Cosmas" <johncosmas@charter.net> wrote in message
> news:%FZre.689$uS2.2@fe03.lga...
needs[color=darkred]

>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com