Re: [OT] was Re: SQL Query Question

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 38624
interpreted = N
texte = John Peacock wrote: > > Charles Kline wrote: > > > > I need to perform a query on an SQL datasource and summarize the results of > > a couple of the columns in the table. To do this in WebCat is no problem, > > but I can't figure out the equivalent syntax in SQL. Any help would be > > appreciated. > > > > [search db=some.db&neItemIDdata=BLANK&ItemTypesumm=T&ItemCatsumm=T] > > > >

> > > > [/search] > > > > select ItemType, ItemCat > from somedatabase > group by ItemType, ItemCat > Actually, I take that back. If you want to get the distinct values in each field, you will need to do what John Hill said and SELECT DISTINCT fieldname from dbfor each field in questions. My way will give you all unique _combinations_ of the fields in question, not a single list of each columns unique values.If you normalize your database, you would have ItemType and ItemCat tables with a single record for each value. Then your main database would key into those tables for the values of each record. See any decent book on relational databases for details.John-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
John Peacock wrote: > > Charles Kline wrote: > > > > I need to perform a query on an SQL datasource and summarize the results of > > a couple of the columns in the table. To do this in WebCat is no problem, > > but I can't figure out the equivalent syntax in SQL. Any help would be > > appreciated. > > > > [search db=some.db&neItemIDdata=BLANK&ItemTypesumm=T&ItemCatsumm=T] > > > >

> > > > [/search] > > > > select ItemType, ItemCat > from somedatabase > group by ItemType, ItemCat > Actually, I take that back. If you want to get the distinct values in each field, you will need to do what John Hill said and SELECT DISTINCT fieldname from dbfor each field in questions. My way will give you all unique _combinations_ of the fields in question, not a single list of each columns unique values.If you normalize your database, you would have ItemType and ItemCat tables with a single record for each value. Then your main database would key into those tables for the values of each record. See any decent book on relational databases for details.John-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ John Peacock

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

shipping costs (1997) Hello??? (1997) Major problem (1999) Installer AppleScript (2000) Editing the search string (1997) SiteGuard Admin Feature ? (1997) SKU (1997) READFILE command? (1998) Encyption mail was Suggestions for Topics ... (1998) Problem (1997) Problems with [Applescript] (1997) Pager notification of completed orders (1998) WebCat b13 CGI -shownext- (1997) Trouble with formula.db + more explanation (1997) [ConvertChars] problem (1997) creator code (1997) Date Time Oddness (1999) ListFiles (1998) shownext example (2001) Date problems-more (1997)