Re: Dynamic query help.

2011-11-10 Thread Ray Meade
Wow, I can't believe I didn't think of using a temporary table to store the dynamic data while it's being edited, that's a great idea. I can't use session variables because it's a grid and would be considered a complex data type. (I was under the impression that session variables can only hold

Re: Dynamic query help.

2011-11-10 Thread Dave Watts
Wow, I can't believe I didn't think of using a temporary table to store the dynamic data while it's being edited, that's a great idea. I can't use session variables because it's a grid and would be considered a complex data type. (I was under the impression that session variables can only

Re: Dynamic query help.

2011-11-07 Thread Ray Meade
Thanks Justin, I wasn't aware that a dynamic query was lost once the page was finished loading. Does the same rule apply to structures? Perhaps I can use a structure to hold the data and update it as changes are made. Basically, I don't want the physical database being updated until the submit

Re: Dynamic query help.

2011-11-07 Thread Russ Michaels
normal variables only exists for the duration of the CF request. you need to use session scope if you want persistence that is specific to each user. On Mon, Nov 7, 2011 at 6:01 PM, Ray Meade raym...@yahoo.com wrote: Thanks Justin, I wasn't aware that a dynamic query was lost once the page was

Re: Dynamic query help.

2011-11-07 Thread Justin Scott
Thanks Justin, I wasn't aware that a dynamic query was lost once the page was finished loading. Does the same rule apply to structures? Yes, that would apply to all variables unless you store them in persistent memory (e.g. database, session scope, write to a file, etc.). In your case I

Re: Dynamic query help.

2011-11-06 Thread Justin Scott
...I'm not sure how to update the dynamic query. Hi Ray, I don't know much about the mechanics of your application, but remember that once the HTML has been generated and the page loaded on the client, the ColdFusion process is finished and that dynamic query doesn't exist in memory anymore

Dynamic query help.

2011-11-05 Thread Ray Meade
I'm writing an app. for an auto repair shop that has a Flash cfgrid containing quantity, description, price and total cost (the quantity times the price). Right now, the initial total cost is being calculated in a view in the database. I've created a dynamic query (using queryNew) to hold all

Query of query help

2011-01-31 Thread Stefan Richter
Hi all, hoping for some advice with querying a query - at least I think that's what's a good fit here but feel free to advise otherwise. I've got a folder which contains 35,000 folders. I've also got a table with lots of records, where the roomid column matches the name of one of the

Re: Query of query help

2011-01-31 Thread Raymond Camden
Um, did you try the where clause? You said it didn't work - how did it not work? Can you show us the full code and the error? On Mon, Jan 31, 2011 at 11:48 AM, Stefan Richter ste...@flashcomguru.com wrote: Hi all, hoping for some advice with querying a query - at least I think that's what's

re: Query of query help

2011-01-31 Thread Jason Fisher
Yes, QoQ will work here. !--- get your folders --- cfdirectory action=list name=roomList type=dir directory=#roomsDir# !--- get the rooms from the DB --- cfquery datasource=#dsn# name=roomsDB SELECT roomid FROM rooms /cfquery cfoutput query=roomList !--- loop through

Re: Query of query help

2011-01-31 Thread Dave Watts
I've got a folder which contains 35,000 folders. Setting aside your QoQ question, you may have problems simply traversing a folder with this many items in it. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small

Re: Query of query help

2011-01-31 Thread Stefan Richter
Thanks. Guess what I was trying to avoid was a loop with 35,000 queries... I was trying to come up wit a clever way to do this in one SQL statement. One issue I noticed is that QoQ does not to seem to (easily?) support joins. Then again I'm no SQL ninja by any means. S On 31 Jan 2011, at

Re: Query of query help

2011-01-31 Thread Stefan Richter
Thanks Dave, listing the folders performs a lot better than I expected, so that's not my issue here. Cheers Stefan On 31 Jan 2011, at 17:57, Dave Watts wrote: I've got a folder which contains 35,000 folders. Setting aside your QoQ question, you may have problems simply traversing

Re: Query of query help

2011-01-31 Thread Jason Fisher
-talk@houseoffusion.com Subject: Re: Query of query help Thanks. Guess what I was trying to avoid was a loop with 35,000 queries... I was trying to come up wit a clever way to do this in one SQL statement. One issue I noticed is that QoQ does not to seem to (easily?) support joins. Then again I'm

Re: Query of query help

2011-01-31 Thread Stefan Richter
I was trying something like this: cfquery name=orphanRooms dbtype=query select * from roomList WHERE name = 'x' cfloop query=roomsDBOR roomList.name = '#roomid#' /cfloop /cfquery I think I am getting somewhere with it. Anything inherently wrong with this? Stefan On 31 Jan 2011, at

Re: Query of query help

2011-01-31 Thread Stefan Richter
Ah great, an interesting approach. Many thanks. Stefan On 31 Jan 2011, at 20:10, Jason Fisher wrote: Stefan, This might work ... can't remember if the IN () function works in QoQ or not. !--- get a list of all the rooms from the DB (after you query) --- cfset roomList =

Re: Query of query help

2011-01-31 Thread Jason Fisher
... From: Stefan Richter ste...@flashcomguru.com Sent: Monday, January 31, 2011 3:21 PM To: cf-talk cf-talk@houseoffusion.com Subject: Re: Query of query help I was trying something like this: cfquery name=orphanRooms dbtype=query select * from roomList

Re: Aggregate query help please

2009-07-17 Thread Seamus Campbell
Hi Barney Your answer was cut - would you mind resending please ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive:

Re: Aggregate query help please

2009-07-17 Thread Barney Boisvert
I have no idea what that was. My sent mail has the same blank message, but I didn't reply. WITH ROLLUP is the clause you want though, if your DB supports it. cheers, barneyb -- Barney Boisvert bboisv...@gmail.com http://www.barneyb.com/ On Jul 17, 2009, at 4:09 PM, Seamus Campbell

Re: Aggregate query help please

2009-07-17 Thread denstar
I've got some code that uses the JExcelAPI for converting queries to Excel spreadsheets. It's got some support for formulas, so theoretically you could wow the people you need to send it to by not only having the sums there, but having them update if they change the numbers in the various

Aggregate query help please

2009-07-16 Thread Seamus Campbell
I have a database (access at the moment) for members of an organisation. The members are scattered throughout (mostly in one state) Australia (with a couple in the US) They all are one of three language groups. I need to export an excel spreadsheet with a count of members from each language

Re: Aggregate query help please

2009-07-16 Thread Barney Boisvert
On Thu, Jul 16, 2009 at 4:57 AM, Seamus Campbellcoldfus...@boldacious.com wrote: I have a database (access at the moment) for members of an organisation. The members are scattered throughout (mostly in one state) Australia (with a couple in the US) They all are one of three language groups.

Re: sql query help

2008-12-06 Thread Jason Fisher
Cool, yeah I never remember until I do it when an aggregate query is going to want HAVING vs WHERE. Glad it's working for you! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free

Re: sql query help

2008-12-06 Thread Brad Wood
- Original Message - From: Jason Fisher [EMAIL PROTECTED] Cool, yeah I never remember until I do it when an aggregate query is going to want HAVING vs WHERE. Glad it's working for you! This bites me too when I'm not paying attention. Just remember that the WHERE applies to the

Re: sql query help

2008-12-05 Thread Jason Fisher
In MS SQL Server it's ISNULL(), but can't speak for other platforms. Can't recall what it is in Oracle, might just be NULL(). ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free

Re: sql query help

2008-12-05 Thread C S
In MS SQL Server it's ISNULL(), but can't speak for other platforms. Can't recall what it is in Oracle, might just be NULL(). IIRC in Oracle it is NVL. There is also COALESCE, which is usually a safe bet with most databases.

Re: sql query help

2008-12-05 Thread Jessica Kennedy
didn't work, got an error. changed the isnull to ifnull, got a invalid use of a group function error... I don't even know how to fix that...=( Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p. short_description, p.quantity,

Re: sql query help

2008-12-05 Thread Jessica Kennedy
NM, got it... changed the where clause to having and moved it below the group by... seems to be working so far! Thanks! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial

sql query help

2008-12-04 Thread Jessica Kennedy
I have a MySQL query to pull all products from the database, no problem. I am trying to get it to only display prodcuts that are in stock, the value should be sold p.quantity in the following query. however, when sold appears as null (very often) it removes the full record, which I don't

Re: sql query help

2008-12-04 Thread Jason Fisher
Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p.short_description, p.quantity, p.image FROM tblproducts as p LEFT JOIN tblorder_list as o ON p.sku = o.sku #can_afford# WHERE SUM(ISNULL(o.qty, 0)) p.quantity GROUP BY p.sku

Re: sql query help

2008-12-04 Thread Azadi Saryev
i believe the correct function to use is IFNULL(), not ISNULL()... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Jason Fisher wrote: Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p.short_description, p.quantity,

Re: query help

2008-06-20 Thread Jessica Kennedy
no luck... I do need the group by clause, my actual query is much larger than the one posted. the problem, for example is this: for five people, paid=no, for five others, paid=yes under one parent sponsor. I am now getting a result of 10, but I need the result to be 5, only counting those

Re: query help

2008-06-20 Thread Matt Williams
Hard to say what is going on. The following works fine for me: SELECT node.userCity,count(node.userCity) FROM core.users AS node, core.users AS parent WHERE parent.userName = node.userFirstName AND node.userCity = 'Pasadena' GROUP BY node.userCity I seem to get the correct number based on the

query help

2008-06-17 Thread Jessica Kennedy
I'm pretty sure I will smack my head when I hear the answer, but I'll ask anyway... I am using a select count() query to get the number of people directly sponsored by a person... this works fine, the problem is that I only want to have the query count people that meet a certain qualification.

Re: query help

2008-06-17 Thread Phillip Vector
Well, is the paid field a character field or a number field in the DB? and just FYI, you can always go #querryName.Recordcount# to get a count via CF. :) On Tue, Jun 17, 2008 at 3:23 PM, Jessica Kennedy [EMAIL PROTECTED] wrote: I'm pretty sure I will smack my head when I hear the answer, but

RE: query help

2008-06-17 Thread Dave Watts
SELECT COUNT(node.name) FROM tbl1 as node, tbl1 as parent WHERE parent.sponsor=node.name AND node.paid='yes' GROUP BY node.name GROUP BY should only be used if you're selecting non-aggregates along with your aggregate. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf

SOT: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Gerald Guido
We are trying to tease out the following: SELECT ProjNum, ClientName, tblProj.Title, StartDate FROM tblProj WHERE (tblProj.Title LIKE '%Cost Plan%') OR(tblProj.Title LIKE '%Cost Allocation Plan%') OR (tblProj.Title LIKE '%CAP%') The problem is that OR

RE: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Gaulin, Mark
: Wednesday, May 21, 2008 1:43 PM To: CF-Talk Subject: SOT: MSSQL Query help - Finding an exact word in a field We are trying to tease out the following: SELECT ProjNum, ClientName, tblProj.Title, StartDate FROM tblProj WHERE (tblProj.Title LIKE '%Cost Plan%') OR(tblProj.Title

RE: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Chad Gray
To: CF-Talk Subject: SOT: MSSQL Query help - Finding an exact word in a field We are trying to tease out the following: SELECT ProjNum, ClientName, tblProj.Title, StartDate FROM tblProj WHERE (tblProj.Title LIKE '%Cost Plan%') OR(tblProj.Title LIKE '%Cost

RE: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Jason Durham
In MySQL... '%CAP %' works. -Original Message- From: Gerald Guido [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2008 12:43 PM To: CF-Talk Subject: SOT: MSSQL Query help - Finding an exact word in a field We are trying to tease out the following: SELECT ProjNum, ClientName

RE: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Chad Gray
, but won't return records with CAPTAIN or CAPITAL. At least I think it will. Try it out. I am not in front of a MS SQL server. -Original Message- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2008 2:17 PM To: CF-Talk Subject: RE: MSSQL Query help - Finding

RE: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Chad Gray
I am full of incomplete thoughts. I _think_ you can abbreviate with a-z and 1-9 instead of typing out the characters. -Original Message- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2008 2:27 PM To: CF-Talk Subject: RE: MSSQL Query help - Finding an exact

Re: MSSQL Query help - Finding an exact word in a field

2008-05-21 Thread Gerald Guido
thoughts. I _think_ you can abbreviate with a-z and 1-9 instead of typing out the characters. -Original Message- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2008 2:27 PM To: CF-Talk Subject: RE: MSSQL Query help - Finding an exact word in a field I re

Query Help - include

2008-05-09 Thread daniel kessler
I am using Oracle and I have a table for expenditures that stores a person's ID when the expenditures is approved. The person's ID is from a People table. When I query, I want to make a new variable that references the other table to put in their full name. I have two problems doing this. 1

Re: Query Help - include

2008-05-09 Thread Ian Skinner
daniel kessler wrote: 1 - I'm not so good at sql and the join only works if there's an id in the approved_by field. This is going to be empty unless the ticket has been approved, but I still want it to work whether it's approved or not. Is that an outter join? Yes it will be an LEFT

Re: Query Help - include

2008-05-09 Thread daniel kessler
I had continued to try and figure it out after I sent the email. I did figure out a way to make it work. FROM expenditures e, people p WHERE e.approved_by = people.id (+) In Oracle, the + does the outer join. And it worked well, but it wasn't explicit. I don't know sql well enough to read

Re: Query Help - include

2008-05-09 Thread Ian Skinner
daniel kessler wrote: I had continued to try and figure it out after I sent the email. I did figure out a way to make it work. FROM expenditures e, people p WHERE e.approved_by = people.id (+) In Oracle, the + does the outer join. Yes, that is the original outer join syntax for Oracle.

Re: Query Help Please

2008-04-29 Thread C S
select *, exists ( select * from orders where date between #date1# and #date2# ) as hasOrdered from customers order by name, id Use CFQUERYPARAM, of course. Another variation is a left join. Ditto on using cfqueryparam. SELECT c.ID, c.Name, c.Email, SUM(CASE WHEN o.Date IS NULL THEN 0

Re: Query Help Please

2008-04-29 Thread Brian Sheridan
I dont believe this is working with Access DB SUM(CASE WHEN o.Date IS NULL THEN 0 ELSE 1 END) ordersFound C S [EMAIL PROTECTED] wrote: select *, exists ( select * from orders where date between #date1# and #date2# ) as hasOrdered from customers order by name, id Use CFQUERYPARAM, of

Re: Query Help Please

2008-04-29 Thread C S
I dont believe this is working with Access DB SUM(CASE WHEN o.Date IS NULL THEN 0 ELSE 1 END) ordersFound I think Access's version of CASE is IIF(..). Try using IIF instead and also try the query Barney suggested. One of them should work.

Query Help Please

2008-04-28 Thread Brian Sheridan
I will try to make this as simple as possible. Any help would be greatly appreciated. I have 2 tables like below. tblCustomers === ID | Name | Email | 1, John, [EMAIL PROTECTED] 2, Bob, [EMAIL PROTECTED] 3, Steve, [EMAIL PROTECTED]

Re: Query Help Please

2008-04-28 Thread Barney Boisvert
select *, exists ( select * from orders where date between #date1# and #date2# ) as hasOrdered from customers order by name, id Use CFQUERYPARAM, of course. cheers, barneyb On Mon, Apr 28, 2008 at 8:57 PM, Brian Sheridan [EMAIL PROTECTED] wrote: I will try to make this as simple as possible.

Re: query help

2008-03-11 Thread Sonny Savage
is the users who have not signed off on viewing one or more documents and the documents on which they've failed to sign off. Subject: query help From: Sonny Savage Date: Mon, 10 Mar 2008 08:39:57 -0400 Thread: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid

Re: query help

2008-03-10 Thread Sonny Savage
Question: Do you also want a result in the case where there is no USER_DOCS record for a given USER and DOC record (FULL OUTER JOIN)? On Sat, Mar 8, 2008 at 12:12 AM, Josh McKinley [EMAIL PROTECTED] wrote: I've got three tables like this (simplified): USERS user_id user_name DOCS doc_id

Re: query help

2008-03-10 Thread Sonny Savage
This query will return all users and docs that have a relationship established but don't have a sign-off record: SELECT u.user_name , d.doc_name FROM user_docs ud INNER JOIN users u ON ud.user_id = u.user_id INNER JOIN docs d ON ud.doc_id = d.doc_id WHERE ud.signoff_id

RE: query help

2008-03-10 Thread Josh McKinley
one or more documents and the documents on which they've failed to sign off. Subject: query help From: Sonny Savage Date: Mon, 10 Mar 2008 08:39:57 -0400 Thread: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55471#300843 Question: Do you also want a result in the case where

Re: query help

2008-03-10 Thread Sonny Savage
. Subject: query help From: Sonny Savage Date: Mon, 10 Mar 2008 08:39:57 -0400 Thread: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55471#300843 Question: Do you also want a result in the case where there is no USER_DOCS record for a given USER and DOC record (FULL OUTER

Re: query help

2008-03-08 Thread Steve Bryant
The nice thing about SQL is you can often write the query almost how you word the problem: SELECT user_id,user_name,doc_id,doc_name FROMUSERS,DOCS WHERE NOT EXISTS ( SELECT signoff_id FROMUSER_DOCS WHERE user_id = USERS.user_id

Re: query help

2008-03-08 Thread Dominic Watson
As a side note, I generally recommend that you have a compound primary key in a join table. So, USERS_DOCS would have a compound primary key of user_id and doc_id and wouldn't need another column. This helps to enforce referential integrity. Or create a unique index / constraint of the two

re: query help

2008-03-08 Thread Josh McKinley
I'm really looking for a solution with only one query using joins. It should be possible to do this with a couple of joins. This query, suggested by Steve, would work well if the tables remained small: SELECT user_id,user_name,doc_id,doc_name FROM USERS,DOCS WHERE NOT EXISTS ( SELECT

Re: query help

2008-03-08 Thread Dominic Watson
In large tables, though, I don't think it's going to be a very good solution. Why not? It should perform fine if there are indexes on the tables. Make a couple of test tables and populate them with a whole load of numbers and test it before rejecting it ;) Anybody know why this doesn't

Re: query help

2008-03-08 Thread Steve Bryant
Josh, I use WHERE EXISTS and WHERE NOT EXISTS with some frequency and I have never run into any performance problems with it. In SQL Server, each join statement needs an on clause, even if it is 1 = 1. I ran some quick tests with about 50 rows in one table, 200 in another, and about a dozen

Re: query help

2008-03-08 Thread Josh McKinley
OK, so let's just say that the where not exists option is comparable in efficiency. I ran the query and was greeted by every row in the tables. 70K results instead of the 60 or so I should be getting. ~| Adobe® ColdFusion® 8

Re: query help

2008-03-08 Thread Steve Bryant
Josh, The SQL I posted worked for me in my tests. If you deviated from that, can you post the SQL that you used? Assuming the join table doesn't have any duplicate rows (and no rows exist in the join table without a match in both of the other tables) then the resultset of the query should

query help

2008-03-07 Thread Josh McKinley
I've got three tables like this (simplified): USERS user_id user_name DOCS doc_id doc_name USER_DOCS signoff_id user_id doc_id I need all user names and doc names where the combination doesn't exist in the signoff table USER_DOCS. For example, user 12 hasn't signed of on doc 9 and user 6

Re: query help

2008-03-07 Thread Josh McKinley
By the way, this is a MySQL DB. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive:

Re: query help

2008-03-07 Thread Dae
I've never worked in MySQL, but take a look at the below. It should get you in the right direction. BTW, it's a 2 step process. 1st, your combining the User and Docs tables to get a list. Then you take that list and bounce it agaist the USER_DOCS table and show anything where SIGNOFF is NULL.

Re: Need query help

2008-03-05 Thread Will Tomlinson
SELECT t.groupid, t.groupname FROM @tblgroups t INNER JOIN @tblgrouptypes gt ON gt.groupid = t.groupid WHERE gt.grouptype in ('College','Jewish') -- This would be dynamic GROUP BY t.groupid, t.groupname HAVING count(*) = 2 -- This would be dynamic ORDER BY t.groupname

RE: Need query help

2008-03-04 Thread Brad Wood
: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 6:27 PM To: CF-Talk Subject: Re: Need query help No, that'll get one or the other - he wants ones that are both. Aliasing will work, something like this: James, I think I got this to work. My first tests are good. I didn't mention

RE: Need query help

2008-03-04 Thread Adkins, Randy
Could do a UNION to gather the results -Original Message- From: Brad Wood [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2008 10:56 AM To: CF-Talk Subject: RE: Need query help If you query is highly dynamic, this way may not be best. Let's say the user can specify groups

RE: Need query help

2008-03-04 Thread Brad Wood
What would that look like? Unioned result sets are not mutually dependant, but Will needs all his criteria to be met. ~Brad -Original Message- From: Adkins, Randy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2008 10:00 AM To: CF-Talk Subject: RE: Need query help Could do a UNION

Re: Need query help

2008-03-04 Thread Nicholas Stein
This should work and is much clearer that your original statement. SELECT t.groupid, t.groupimage, t.groupname, t.groupcity, t.state, t.voicingid, t.groupcontactperson, t.country, t.region, x.groupid,

RE: Need query help

2008-03-04 Thread Brad Wood
, 2008 10:50 AM To: CF-Talk Subject: Re: Need query help This should work and is much clearer that your original statement. SELECT t.groupid, t.groupimage, t.groupname, t.groupcity, t.state, t.voicingid, t.groupcontactperson, t.country

Re: Need query help

2008-03-04 Thread Jochem van Dieten
Brad Wood wrote: If you query is highly dynamic, this way may not be best. Let's say the user can specify groups that are of type college, jewish, preschool, catholic, and skinny. Now, you have to join to the type table 5 times and that ain't looking too good. Joining is what databases are

RE: Need query help

2008-03-04 Thread Brad Wood
-Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2008 12:12 PM To: CF-Talk Subject: Re: Need query help Joining is what databases are good at. === Flying is what birds are good at; but why send the whole

Re: Need query help

2008-03-04 Thread Tom Donovan
Will Tomlinson wrote: Hey, I've got groups that can have one or more types associated with them. I have a linking table that I'm querying and filtering. But I'm not getting the results I need. Example: A group can be both 'College' and 'Jewish', as listed in the many linking table -

Need query help

2008-03-03 Thread Will Tomlinson
Hey, I've got groups that can have one or more types associated with them. I have a linking table that I'm querying and filtering. But I'm not getting the results I need. Example: A group can be both 'College' and 'Jewish', as listed in the many linking table - tblgrouptypes_x.grouptype In

Re: Need query help

2008-03-03 Thread Greg Morphis
To make your query more readable, can you alias your tables? SELECT g.groupid, g.groupimage, g.groupname, g.groupcity, g.state, g.voicingid, g.groupcontactperson, g.country, g.region, gtx.groupid, gtx.grouptype, gt.grouptype FROM tblgroups g, tblgrouptypes gt, tblgrouptypes_x

Re: Need query help

2008-03-03 Thread Will Tomlinson
If you take out one or the other, does it return the results? Yes. I get valid results if I remove one of the AND's. I can just pull jewish groups for instance. Originally, I used IN ('jewish',college'). But that returns ALL jewish groups, and ALL college groups. My client wants it to

RE: Need query help

2008-03-03 Thread ColdFusion
Try changing your AND statement to an OR statement: AND (tblgrouptypes_x.grouptype = 'College' OR tblgrouptypes_x.grouptype = 'Jewish') -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 5:39 PM To: CF-Talk Subject: Need query help Hey

RE: Need query help

2008-03-03 Thread Brad Wood
: Monday, March 03, 2008 5:37 PM To: CF-Talk Subject: RE: Need query help Try changing your AND statement to an OR statement: AND (tblgrouptypes_x.grouptype = 'College' OR tblgrouptypes_x.grouptype = 'Jewish') -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday

Re: Need query help

2008-03-03 Thread James Holmes
: AND (tblgrouptypes_x.grouptype = 'College' OR tblgrouptypes_x.grouptype = 'Jewish') -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2008 5:39 PM To: CF-Talk Subject: Need query help Hey, I've got groups that can have one or more types

Re: Need query help

2008-03-03 Thread Will Tomlinson
I'm a little unsure of what your query is expected to return. If a group can have multiple types, then I assume that there is a one-to-many relationship between groups and types, where a single group record has one or more type records. Correct. You are returning type in your query, so a

RE: Need query help

2008-03-03 Thread Brad Wood
If there's a group that's jewish and college, I just need a single record returned. = Then removed type from the select list, group by everything else with an or equivalent in your where clause and add the having count(*) 1 to the end. That will only return groups which

Re: Need query help

2008-03-03 Thread Dominic Watson
If you HAVE to have both jewish and college types and only one record returned, try this: SELECT tblgroups.*, !--- i wouldn't do this, just saving space here ;) --- tblgrouptypes_x.groupid, tblgrouptypes_x.grouptype !--- perhaps returning this value is misleading as it can only tell you one of

Re: Need query help

2008-03-03 Thread Will Tomlinson
No, that'll get one or the other - he wants ones that are both. Aliasing will work, something like this: James, I think I got this to work. My first tests are good. I didn't mention this is a highly dynamic query. I have quite a few other filters in play, but your example would work nicely

Re: Query Help - find unique rows in two similar tables

2008-02-11 Thread Jim McAtee
It was pretty close. Running it in one direction, knowing that table B has extra records, works fine. - Original Message - From: Dawson, Michael [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Monday, February 11, 2008 7:59 PM Subject: RE: Query Help - find unique rows

RE: Query Help - find unique rows in two similar tables

2008-02-11 Thread Dawson, Michael
To: CF-Talk Subject: Query Help - find unique rows in two similar tables I have two tables with identical structures. The data in the two tables is _nearly_ identical, with one table having a few additional rows. I need to find those additional rows. I want to query the two tables and find

RE: Query Help - find unique rows in two similar tables

2008-02-11 Thread Dawson, Michael
PM To: CF-Talk Subject: RE: Query Help - find unique rows in two similar tables SELECT a.* ,b.* FROM TableA a FULL OUTER JOIN TableB b ON a.id = b.id WHERE a.id IS NULL OR b.id IS NULL (Untested) M!ke

Query Help - find unique rows in two similar tables

2008-02-11 Thread Jim McAtee
I have two tables with identical structures. The data in the two tables is _nearly_ identical, with one table having a few additional rows. I need to find those additional rows. I want to query the two tables and find the rows in one or the other that are not present in both. It would be OK

RE: query help

2007-12-09 Thread Adrian Lynch
If ROUND isn't there, look for another rounding function like CEILING, FLOOR etc. Adrian -Original Message- From: Dave l Sent: 09 December 2007 04:18 To: CF-Talk Subject: Re: query help if i change the select statement to: SELECT center_id, address1, city, state, postalcode

Re: query help

2007-12-09 Thread Greg Morphis
- From: Dave l Sent: 09 December 2007 04:18 To: CF-Talk Subject: Re: query help if i change the select statement to: SELECT center_id, address1, city, state, postalcode, state, ROUND((ACOS((SIN(#lat_A#/57.2958) * SIN(#lat_B#/57.2958)) + it changes the error

Re: query help

2007-12-09 Thread Jon Clausen
Looks like CEIL() or CEILING() is the function you're looking for: http://db.apache.org/derby/docs/10.2/ref/refderby.pdf HTH, Jon On Dec 8, 2007, at 11:18 PM, Dave l wrote: if i change the select statement to: SELECTcenter_id, address1, city, state, postalcode, state,

Re: query help

2007-12-09 Thread Dave l
I'll take a look at those thanks guys Looks like CEIL() or CEILING() is the function you're looking for: http://db.apache.org/derby/docs/10.2/ref/refderby.pdf HTH, Jon On Dec 8, 2007, at 11:18 PM, Dave l wrote: if i change the select statement to: SELECT center_id,

Re: query help

2007-12-09 Thread Dave l
change one thing it errors on another lol now it errors on the , I'll take a look at those thanks guys ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex

query help

2007-12-08 Thread Dave l
i am trying to write a quite tutorial for learncf on a dealer locator. I guess you have to use one of the included db's so I am using one of the derby ones cause well.. thats all there is and this query is choking on it, it works on mysql but I know diddlysquat about derby the query SELECT

Re: query help

2007-12-08 Thread Dave l
if i change the select statement to: SELECT center_id, address1, city, state, postalcode, state, ROUND((ACOS((SIN(#lat_A#/57.2958) * SIN(#lat_B#/57.2958)) + it changes the error to: 'ROUND' is not recognized as a function or procedure. so i might be sol on this tut

SOLVED: Query help...

2007-12-03 Thread Will Tomlinson
I got it fixed. Thanks, Will ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Query help...

2007-12-03 Thread Will Tomlinson
Hey, I have 3 tables - one to many rel. tblreports reportid PK lotsmorefieldsforfiltering tblquestioncomments questioncommentid PK reportid FK questionid FK tblquestions questionidPK Originally I just needed a question count based off a specific question ID. As my

Query help for Spry Dataset

2007-11-18 Thread Joel Watson
I have three tables, worship_songs, worship_sets, worship_song_lists. worship_songs: worship_songID worship_song_title worship_song_lyrics worship_sets: worship_setID worship_set_title worship_set_date worship_song_lists: worship_song_listID worship_songID_fk worship_setID_fk I have a spry

  1   2   3   4   5   >