RE: Help with SQL

2000-08-14 Thread Chapman, Katrina

You use the SQL DatePart function

select DatePart(mm, columnname) as month
from foo


--K

-Original Message-
From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 14, 2000 3:52 PM
To: [EMAIL PROTECTED]
Subject: Help with SQL



I have a date and time field in the form of 8/14/00 in an Access database. I
want to be able to select out the distinct months in all the fields. It
seems that I can't do that.

Do I have to redo the database and separate the month? Or do I have to
process the query with some kind of CF code?

Sebastian


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Help with SQL

2000-08-14 Thread David Cummins

In SQL server there is a month function, i.e. month(getdate()) or month(mydate).
Access may have the same function. If you are going to be ordering them,
remember to take the year into account if it spans the end of a year.

David

sebastian palmigiani wrote:
> 
> I have a date and time field in the form of 8/14/00 in an Access database. I
> want to be able to select out the distinct months in all the fields. It
> seems that I can't do that.
> 
> Do I have to redo the database and separate the month? Or do I have to
> process the query with some kind of CF code?
> 
> Sebastian
> 
> --
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Help with SQL

2000-08-14 Thread sebastian palmigiani

I tried that in Access and got an error message. I think this is available
in SQL Server but not Access.

Sebastian


on 8/14/00 5:58 PM, Chapman, Katrina at [EMAIL PROTECTED] wrote:

> You use the SQL DatePart function
> 
> select DatePart(mm, columnname) as month
> from foo
> 
> 
> --K
> 
> -Original Message-
> From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 14, 2000 3:52 PM
> To: [EMAIL PROTECTED]
> Subject: Help with SQL
> 
> 
> 
> I have a date and time field in the form of 8/14/00 in an Access database. I
> want to be able to select out the distinct months in all the fields. It
> seems that I can't do that.
> 
> Do I have to redo the database and separate the month? Or do I have to
> process the query with some kind of CF code?
> 
> Sebastian
> 
> 
> --
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> --
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
> body.
> 

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: Help with SQL

2000-08-16 Thread Andy Ewings

the problem is that if you use distinct it takes into account all of the
fields that you have included in your select.

If you are not using them, why are you including Events.ProgramName,
Events.ProgramDate in your select list?  If you omit these and use diatinct
it will work...e.g:

SELECT DISTINCT MonthlyTheme.ThemeName
FROM   MonthlyTheme, Events
WHERE  MonthlyTheme.ThemeID = Events.ThemeID
AND Events.ProgramDate BETWEEN #StartMonth# AND #EndMonth#


-Original Message-
From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
Sent: 16 August 2000 16:59
To: [EMAIL PROTECTED]
Subject: Help with SQL


I have 2 tables with a One (MonthlyTheme) to Many (Events) relationship. I
want to be able to select Programs within a certain range and to also
isolate the ThemeName with one query. The cfoutput below gives multiple
displays of the same ThemeName equal to the number of records. I just want
it to be shown one time. I tried to use DISTINCT but it did not work.

Is this do able with one query or do I have to use 2 queries?

SELECT Events.ProgramName, Events.ProgramDate, MonthlyTheme.ThemeName,
FROM   Events, MonthlyTheme
WHERE  MonthlyTheme.ThemeID = Events.ThemeID
AND Events.ProgramDate BETWEEN #StartMonth# AND #EndMonth#



MonthlyTheme: #ThemeName#


Sebastian


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: Help with SQL

2000-08-16 Thread Dan Haley

#ShowEvents.ThemeName[1]#

Dan

-Original Message-
From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 16, 2000 8:59 AM
To: [EMAIL PROTECTED]
Subject: Help with SQL


I have 2 tables with a One (MonthlyTheme) to Many (Events) relationship. I
want to be able to select Programs within a certain range and to also
isolate the ThemeName with one query. The cfoutput below gives multiple
displays of the same ThemeName equal to the number of records. I just want
it to be shown one time. I tried to use DISTINCT but it did not work.

Is this do able with one query or do I have to use 2 queries?

SELECT Events.ProgramName, Events.ProgramDate, MonthlyTheme.ThemeName,
FROM   Events, MonthlyTheme
WHERE  MonthlyTheme.ThemeID = Events.ThemeID
AND Events.ProgramDate BETWEEN #StartMonth# AND #EndMonth#



MonthlyTheme: #ThemeName#


Sebastian


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: HELP with SQL

2002-12-09 Thread Matthew Walker
Try verifying all your datasources in CF admin. If they all fail, open
Control Panel > Administrative tools > services and check ColdFusion MX
ODBC Server is running.

Matthew Walker
ESW
http://www.electricsheep.co.nz/

> -Original Message-
> From: Rebecca Joy Sherman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 10 December 2002 12:28 p.m.
> To: CF-Talk
> Subject: HELP with SQL
> 
> 
> HELP, I keep getting this error.  on the CFMX administrator:
> 
> 
> 
> Connection verification failed for data source: contacts
> []java.sql.SQLException: SQLException occurred in JDBCPool 
> while attempting 
> to connect, please check your username, password, URL, and other 
> connectivity info.
> The root cause was that: java.sql.SQLException: SQLException 
> occurred in 
> JDBCPool while attempting to connect, please check your 
> username, password, 
> URL, and other connectivity info.
> 
> 
> Joy
> 
> 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



RE: Help With SQL Query

2000-11-29 Thread Hayes, David

Well, the problem is with your join - each row in table 1 is being joined
with EVERY row in table 2, so that your result set is 6 rows rather than 3.
What happens if you take out the where a.user=b.user condition and just have
WHERE a.user = 'karl' and b.user = 'karl'?

If you give us a little more information, we might be able to recommend some
alternatives.

Some options:

1) Use a UNION

2) Use 2 queries




-Original Message-
From: Gary Groomer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 29, 2000 10:08 AM
To: CF-Talk
Subject: Help With SQL Query


I have two tables from which I want the sum of the columns based on a common
key.  From the below tables, the desired output is 3,5,1,2.  Instead I get
6,10,6,3.  I am sure the solution is simple, but I haven't run into this one
before and any help would be appreacited.

Gary

Table1
---
TableIDUserCol1Col2
1Karl10
2Karl02
3Karl23

Table2
---
TableIDUserCol1Col2
1Karl10
2Karl02

SQL Query
-
SELECT Sum(a.Col1), Sum(a.Col2), Sum(b.Col1), Sum(b.Col2)
FROM Table1 a, Table2 b
WHERE a.User = b.User
AND a.User = 'Karl'

~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Help With SQL Query

2000-11-29 Thread Gary Groomer

Using a UNION did the trick.  Thanks for the tip.

Gary

- Original Message -
From: "Hayes, David" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, November 29, 2000 8:21 AM
Subject: RE: Help With SQL Query


> Well, the problem is with your join - each row in table 1 is being joined
> with EVERY row in table 2, so that your result set is 6 rows rather than
3.
> What happens if you take out the where a.user=b.user condition and just
have
> WHERE a.user = 'karl' and b.user = 'karl'?
>
> If you give us a little more information, we might be able to recommend
some
> alternatives.
>
> Some options:
>
> 1) Use a UNION
>
> 2) Use 2 queries
>
>
>
>
> -Original Message-
> From: Gary Groomer [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 29, 2000 10:08 AM
> To: CF-Talk
> Subject: Help With SQL Query
>
>
> I have two tables from which I want the sum of the columns based on a
common
> key.  From the below tables, the desired output is 3,5,1,2.  Instead I get
> 6,10,6,3.  I am sure the solution is simple, but I haven't run into this
one
> before and any help would be appreacited.
>
> Gary
>
> Table1
> ---
> TableIDUserCol1Col2
> 1Karl10
> 2Karl02
> 3Karl23
>
> Table2
> ---
> TableIDUserCol1Col2
> 1Karl10
> 2Karl02
>
> SQL Query
> -
> SELECT Sum(a.Col1), Sum(a.Col2), Sum(b.Col1), Sum(b.Col2)
> FROM Table1 a, Table2 b
> WHERE a.User = b.User
> AND a.User = 'Karl'
>
> ~~
> Structure your ColdFusion code with Fusebox. Get the official book at
> http://www.fusionauthority.com/bkinfo.cfm
>
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> ~~
> Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
>
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
>
>

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Help with SQL statement

2001-03-23 Thread Russ Conway

> I'm doing a select from three tables, and my query is timing out.  The
> problem is probably coming from the fact that there is not always a
> record in the m.POS_ARC_HEADX table.  Is there a way to restructure this
> query so it still checks the m.POS_ARC_HEADX but does not die if no
> record exists?  Is there another reason this query might be dying?

> 
> SELECT  m.POS_ARC_HEAD.DocNo, m.POS_ARC_HEAD.CrName,
> m.POS_ARC_SKU.SKU,
> m.POS_ARC_SKU.Description, m.POS_ARC_HEADX.PersonAuthToCharge
>
> FROM m.POS_ARC_HEAD, m.POS_ARC_HEADX, m.POS_ARC_SKU
>
> WHERE   m.POS_ARC_HEAD.DocNo = m.POS_ARC_HEADX.DocNo AND
>m.POS_ARC_HEADX.DocNo = m.POS_ARC_SKU.DocNo
>  AND m.POS_ARC_HEADX.DocNo =
> "#URL.RetrieveDoc#"
> 

You can handle the missing records in the POS_ARC_HEADX table by using an
outer join. The syntax varies a little depending on what database you are
using, so I'd suggest checking the SQL help that comes with the database.
You may want to change the second WHERE condition to join to the
POS_ARC_HEAD table instead of the POS_ARC_HEADX, unless you intend to
exclude records that may be in POS_ARC_SKU but are not in POS_ARC_HEADX.

As far as the query timing out, the query will run a lot faster if you have
an index on the DocNo field in all three tables. Depending on the size of
the tables that may make a big difference.


Russell Conway
HallofSports.com, Inc.
351 West 22nd Street
New York, NY 10011
P (646) 638-2500
F (646) 638-3444
http://www.hallofsports.com
.. . . where the legends live on



~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Help with sql server

2001-08-05 Thread Correa, Orlando (ITSC)

Try prefixing your table name with the database.owner

e.g.  FROM mydatabase.databaseowner.report2s

-Original Message-
From: Neo Fusion [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 05, 2001 10:08 PM
To: CF-Talk
Subject: Help with sql server


I have converted a access database to sql server 7.0 my tables have not
changed but everytime i try and access any page that has a database call i
recieve the following error


ODBC Error Code = S0002 (Base table not found)


[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'report2s'.


SQL = "SELECT picture, lastupdated, id FROM report2s WHERE ((id)=4 Or (id)=5
Or (id)=6)"

Data Source = "xx"


The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (3:1) to (3:55) in the template file
e:\inetpub\wwwroot\evisions\index.cfm.


Date/Time: 08/06/01 00:04:38
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Remote Address: 127.0.0.1
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Help with sql server

2001-08-05 Thread Jerry Staple

Hi
I had that trouble a couple of weeks ago try this:

Open up cf administrator

Locate your Data base and double click on it;

1.Make sure the server name is correct.
2.Tick the "use trusted connection"
3.Type the name of your db into the login info.


Try that, hope it helps 

All the Best

Jerry Staple 

Web Application Developer
Biznet Solutions
133-137 Lisburn Road, Belfast 
Northern Ireland BT9 7AG 
T  +44 (0) 28 9022 3224 
F  +44 (0) 28 9022 3223 
E  [EMAIL PROTECTED]
 
W  biznet-solutions.com  











-Original Message-
From: Neo Fusion [mailto:[EMAIL PROTECTED]]
Sent: 06 August 2001 05:08
To: CF-Talk
Subject: Help with sql server


I have converted a access database to sql server 7.0 my tables have not
changed but everytime i try and access any page that has a database call
i
recieve the following error


ODBC Error Code = S0002 (Base table not found)


[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'report2s'.


SQL = "SELECT picture, lastupdated, id FROM report2s WHERE ((id)=4 Or
(id)=5
Or (id)=6)"

Data Source = "xx"


The error occurred while processing an element with a general identifier
of
(CFQUERY), occupying document position (3:1) to (3:55) in the template
file
e:\inetpub\wwwroot\evisions\index.cfm.


Date/Time: 08/06/01 00:04:38
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Remote Address: 127.0.0.1
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: [Help with sql server]

2001-08-06 Thread Alex

try...
where ID IN (4,5,6)

"Neo Fusion" <[EMAIL PROTECTED]> wrote:
I have converted a access database to sql server 7.0 my tables have not
changed but everytime i try and access any page that has a database call i
recieve the following error


ODBC Error Code = S0002 (Base table not found)


[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'report2s'.


SQL = "SELECT picture, lastupdated, id FROM report2s WHERE ((id)=4 Or (id)=5
Or (id)=6)"

Data Source = "xx"


The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (3:1) to (3:55) in the template file
e:\inetpub\wwwroot\evisions\index.cfm.


Date/Time: 08/06/01 00:04:38
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Remote Address: 127.0.0.1
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Help with sql server

2001-08-06 Thread Dave Watts

> I have converted a access database to sql server 7.0 my 
> tables have not changed but everytime i try and access any 
> page that has a database call i recieve the following error
> 
> ODBC Error Code = S0002 (Base table not found)
> 
> [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
> 'report2s'.

The most common cause for this problem, in my experience, is the failure to
enter the database name (not the database server name) into the appropriate
field when configuring the datasource. By default, with SQL Server, if you
do that, you'll usually get the master database.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: help with SQL 'IN' operator

2002-10-15 Thread Bryan Love

First: put a comma before and after the list you are inserting into the DB.
So a list of "1,2,3,4" becomes ",1,2,3,4,"

Second: use this query:

 SELECT title
 FROM content
 WHERE keywordIDs LIKE '%,23,%'
 AND keywordIDs LIKE '%,12,%'


+---+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis

"Let's Roll"
- Todd Beamer, Flight 93



-Original Message-
From: Gyrus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 11:14 AM
To: CF-Talk
Subject: OT: help with SQL 'IN' operator


I'm trying to run a query than uses the IN operator in a way I've not come
across before:


 SELECT title
 FROM content
 WHERE 23 IN (keywordIDs)
 AND 12 IN (keywordIDs)


So, instead of saying "WHERE [a certain field] IN ([comma-separated list of
dynamic values])", I'm looking for records where a dynamic value is IN a
field that contains a comma-separated list of values. I get the error "Data
type mismatch in criteria expression."

I guess this might be an invalid use of IN (i.e. you can only use it with
the DB field on the left of the operator). Doesn't seem like something that
should be invalid - but if it is, how can I achieve the same query?

Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
PGP key available


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: help with sql query/CF

2001-01-25 Thread John Anderson

Select fruit,count(fruit)
>From greengrocer
Group By fruit

John Anderson
http://www.aloha-webdesign.com



-Original Message-
From: chad jackson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 3:40 PM
To: CF-Talk
Subject: help with sql query/CF


Hi,

I have a standard query like:

SELECT fruit
FROM greengrocer
ORDER BY fruit

Which returns

apple
apple
bananna
pineapple
pineapple
pineapple

How do I get sql/cold fusion to return
apple (2)
bananna (1)
pineapple (3)

Any help would really be appreciated

thanks
chad
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: help with sql query/CF

2001-01-26 Thread Christoph Schmitz

Hi,

SELECT DISTINCT fruit, count(fruit) AS fruitcount
FROM greengrocer
GROUP BY fruit
ORDER BY fruit

HTH,

Chris

--Original Message--
From: "chad jackson" <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Sent: January 25, 2001 11:39:49 PM GMT
Subject: help with sql query/CF


Hi,

I have a standard query like:

SELECT fruit
FROM greengrocer
ORDER BY fruit

Which returns

apple
apple
bananna
pineapple
pineapple
pineapple

How do I get sql/cold fusion to return
apple (2)
bananna (1)
pineapple (3)

Any help would really be appreciated

thanks
chad
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: help with sql query/CF

2001-01-26 Thread Russel Madere

Try:

SELECT fruit, COUNT(fruit) AS NumFruits
FROM greengrocer
GROUP BY fruit
ORDER BY fruit


  Russel Madere, Jr. Senior Web Developer  
  ICQ: 5446158   http://www.TurboSquid.com   

Some days you eat the bear; some days the bear eats you.

 

> -Original Message-
> From: chad jackson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 25, 2001 16:21
> To: CF-Talk
> Subject: help with sql query/CF
> 
> 
> Hi,
> 
> I have a standard query like:
> 
> SELECT fruit
> FROM greengrocer
> ORDER BY fruit
> 
> Which returns
> 
> apple
> apple
> bananna
> pineapple
> pineapple
> pineapple
> 
> How do I get sql/cold fusion to return
> apple (2)
> bananna (1)
> pineapple (3)
> 
> Any help would really be appreciated
> 
> thanks
> chad
> 
> 
> 
>
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists