Query of Query problem: Merging and sorting two query results

2013-01-29 Thread Les Mizzell
I have two separate queries, basically a table of NEW stuff, and then a table of OLD stuff that's not been converted to new yet. Not all fields in the two tables match. So, first query finds all the matching NEW things Second query finds all the OLD things that aren't present in the NEW

Re: Query of Query problem: Merging and sorting two query results

2013-01-29 Thread Russ Michaels
You need to alias the columns in the original queries to they both match, and you must have same number of colums, so exclude the ones that don't exist in both tables. Regards Russ Michaels www.michaels.me.uk www.cfmldeveloper.com - Free CFML hosting for developers www.cfsearch.com - CF search

Re: Query of Query problem: Merging and sorting two query results

2013-01-29 Thread Claude Schnéegans
Is there a way around this? Just create empty columns when they are missing, ie: *SELECT* first_name, last_name, off1_name, off2_name, off3_name, atty_id, email FROM newstuff UNION SELECT first_name, last_name,

Re: Query of Query problem: Merging and sorting two query results

2013-01-29 Thread Les Mizzell
On 1/29/2013 4:16 PM, =?ISO-8859-1?Q?Claude_Schn=E9egans wrote: Just create empty columns when they are missing, ie: '' AS off1_name, Ahhh - that works! Didn't know you could do that! Thanks ~| Order the Adobe

SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many thanks, Jenny ~| Order the Adobe Coldfusion Anthology now!

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
select * from b where id not in (select id from a) On Tue, Jun 21, 2011 at 12:37 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many

Re: SQL Query Problem

2011-06-21 Thread Greg Morphis
if your tables are large, you'll probably see a better performance from select id from TableA a where not exists (select 1 from TableB b where a.id = b.id) On Tue, Jun 21, 2011 at 12:41 PM, John M Bliss bliss.j...@gmail.com wrote: select * from b where id not in (select id from a) On Tue,

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Thanks John and Greg :) -Original Message- From: Greg Morphis [mailto:gmorp...@gmail.com] Sent: 21 June 2011 18:45 To: cf-talk Subject: Re: SQL Query Problem if your tables are large, you'll probably see a better performance from select id from TableA a where not exists (select 1

Re: SQL Query Problem

2011-06-21 Thread Carl Von Stetten
How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On 6/21/2011 10:37 AM, Jenny Gavin-Wear wrote: Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many thanks,

Re: SQL Query Problem

2011-06-21 Thread Stephane Vantroyen
I would do it this way : select b.* from b where b.id not in (select a.id from a) How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On 6/21/2011 10:37 AM, Jenny Gavin-Wear wrote: ~|

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
That looks familiar! :-) On Tue, Jun 21, 2011 at 1:09 PM, Stephane Vantroyen s...@emakina.com wrote: I would do it this way : select b.* from b where b.id not in (select a.id from a) How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Looks like I went with the vote, lol Many thanks for all replies, and fast too :) Some payments from Paypal transactions, some manually entered on profiles. Legacy code :/ Jenny select * from tbl_members where (datepart(m,paid) = #session.month# and datepart(,paid) = #session.year# AND

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many thanks for all replies, and fast too :) Some payments from Paypal transactions, some manually entered on

Re: SQL Query Problem

2011-06-21 Thread Ras Tafari
+420 On Tue, Jun 21, 2011 at 2:45 PM, Michael Grant mgr...@modus.bz wrote: Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many thanks for all replies, and fast

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
She didn't provide column names... On Tue, Jun 21, 2011 at 1:45 PM, Michael Grant mgr...@modus.bz wrote: Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
I was waiting for a comment on that. It's a very small table :) -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 19:46 To: cf-talk Subject: Re: SQL Query Problem Off topic, but the Select * made me shudder

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: I was waiting for a comment on that. It's a very small table :) -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 19:46 To: cf-talk Subject: Re: SQL Query Problem Off topic, but the Select

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Hi Michael, The (very old) web site is about to be completely redeveloped, so I'm really not too worried. Appreciate your concern though :) Jenny -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 23:27 To: cf-talk Subject: Re: SQL Query Problem

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 23:27 To: cf-talk Subject: Re: SQL Query Problem Right, but if that table grows and columns are added, the overhead on your query will grow. Having a small table makes it even easier to define the columns in your select list

creating variables from a query problem

2009-05-28 Thread alex poyaoan
HI everybody,, Am stucked... I have a query with 9 rows. I need to store every row into a different distinct variable. my query is listed below cfquery name=getcs datasource=#datasource# SELECT COUNT(s.id) AS cscount FROMSociety s WHERE s.gr='cs' group by s.asst /cfquery cfoutput

Re: creating variables from a query problem

2009-05-28 Thread Peter Boughton
I need to store every row into a different distinct variable. You probably don't, and should instead be using an array. MyValues = ListToArray( ValueList( MyQuery.ColumnName ) ) Then you can do MyValues[1] to MyValues[9] to get at the variables. If you *really* need to create individual

Re: creating variables from a query problem

2009-05-28 Thread alex poyaoan
Thanks will do that then I need to store every row into a different distinct variable. You probably don't, and should instead be using an array. MyValues = ListToArray( ValueList( MyQuery.ColumnName ) ) Then you can do MyValues[1] to MyValues[9] to get at the variables. If you

Re: creating variables from a query problem

2009-05-28 Thread Scott Stroz
Just to throw out another solution, you can get the same result you initailly tried by doing the following: cfloop query=getcs cfset variables[rowgetcs.currentRow] = getcs.cscount / /cfloop On Thu, May 28, 2009 at 7:58 AM, Peter Boughton bought...@gmail.com wrote: I need to store every

Re: creating variables from a query problem

2009-05-28 Thread James Holmes
And finally, you could simpy reference the original query using array notation (e.g. getcs[cscount][1], getcs[cscount][2] etc) and avoid the extra work. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/5/28 Scott Stroz boyz...@gmail.com: Just to throw out

Re: coldfusion query problem

2007-10-23 Thread erik tom
Instead of cast('#form.test#' as int(4)) I'd try #val(form.test)# and a cfqueryparam would probably help the situation as well Original Message --- I have a input box wher I am getting the value for my where clause. INstead I am getting the error Error

coldfusion query problem

2007-10-22 Thread erik tom
I have a input box wher I am getting the value for my where clause. INstead I am getting the error Error converting the varchar value to a column of data type int cfquery name=infoNote datasource=X SELECT apr.reqid, apr.requirement,

Re: coldfusion query problem

2007-10-22 Thread Azadi Saryev
why do you need to use cast? can't you just use cfqueryparam cfsqltype=cf_sql_integer value=#form.test#? -- Azadi Saryev Sabai-dee.com http://www.sabai-dee.com ~| Check out the new features and enhancements in the latest

RE: coldfusion query problem

2007-10-22 Thread jake
Instead of cast('#form.test#' as int(4)) I'd try #val(form.test)# and a cfqueryparam would probably help the situation as well Original Message --- I have a input box wher I am getting the value for my where clause. INstead I am getting the error Error converting the

RE: Query Problem

2006-12-29 Thread Bruce Sorge
Message- From: James Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, December 28, 2006 9:51 PM To: CF-Talk Subject: Re: Query Problem You have a query with 100 rows and you are trying to set a cell in row 1920. 1920 is greater than 100. On 12/29/06, Bruce Sorge [EMAIL PROTECTED] wrote: Hello. I

Re: Query Problem

2006-12-29 Thread James Holmes
it crated 2020 rows which sucked. Thanks -Original Message- From: James Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, December 28, 2006 9:51 PM To: CF-Talk Subject: Re: Query Problem You have a query with 100 rows and you are trying to set a cell in row 1920. 1920 is greater

Re: Query Problem

2006-12-29 Thread Bruce Sorge
: Query Problem You have a query with 100 rows and you are trying to set a cell in row 1920. 1920 is greater than 100. On 12/29/06, Bruce Sorge [EMAIL PROTECTED] wrote: Hello. I have these three queries that I am creating below. The first two work great, but the third one gives me

Query Problem

2006-12-28 Thread Bruce Sorge
Hello. I have these three queries that I am creating below. The first two work great, but the third one gives me the following error: The row number, (1920) is out of bound. This is happening on line 48 which is this one: cfset temp = QuerySetCell(yearQuery, year_num, #yearnumber[year_number]#,

Re: Query Problem

2006-12-28 Thread James Holmes
You have a query with 100 rows and you are trying to set a cell in row 1920. 1920 is greater than 100. On 12/29/06, Bruce Sorge [EMAIL PROTECTED] wrote: Hello. I have these three queries that I am creating below. The first two work great, but the third one gives me the following error: The

Re: Query Problem

2006-11-06 Thread Doug Brown
varchar(255), year smallint(5) unsigned - Original Message - From: Jim McAtee [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Sunday, November 05, 2006 11:22 PM Subject: Query Problem I have a database of music CDs, something like: album - albumid int(10

RE: Query Problem

2006-11-06 Thread Bobby Hartsfield
06, 2006 7:37 AM To: CF-Talk Subject: Re: Query Problem Looks like you might need to add an additional field to your albums table. Then populate it with the artists id's that are associated with speccific albums. Also might want to add the same to your track table. albumid int(10) unsigned

RE: Query Problem

2006-11-06 Thread Bobby Hartsfield
Actually I think that would be a grouping issue (once you fixed the 'seletc' type)... and I hate 'GROUP BY' clauses... they get me every time! At the risk of being bashed for using 'IN'... try this select albumtitle, name, year from album, artist where albumid =

Re: Query Problem

2006-11-06 Thread Doug Brown
Actually, you should use a inner join on that, so not to return records you do not need. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered

Re: Query Problem

2006-11-06 Thread Steve Bryant
I tend to find that exists is very helpful for these situation (and reads like the english version of what I want). SELECT artistid,name FROMartist WHERE EXISTS ( SELECT artistid FROMtrack INNER JOIN artisttrack

RE: Query Problem

2006-11-06 Thread Bobby Hartsfield
- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Monday, November 06, 2006 9:10 AM To: CF-Talk Subject: Re: Query Problem Actually, you should use a inner join on that, so not to return records you do not need. ~| Introducing

Re: Query Problem

2006-11-06 Thread Doug Brown
- Original Message - From: Bobby Hartsfield [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Monday, November 06, 2006 7:14 AM Subject: RE: Query Problem Im not sure which one you mean. The first one I posted DID use inner joins and the problem was of course returning the same

RE: Query Problem

2006-11-06 Thread Joshua Cyr
. Joshua -Original Message- From: Steve Bryant [mailto:[EMAIL PROTECTED] Sent: Monday, November 06, 2006 8:03 AM To: CF-Talk Subject: Re: Query Problem I tend to find that exists is very helpful for these situation (and reads like the english version of what I want). SELECT artistid,name

RE: Query Problem

2006-11-06 Thread Bobby Hartsfield
Ahh gotcha. Still hasn’t come through. Im sure you can see why I thought you meant mine thoguh ;-) cheers -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Monday, November 06, 2006 9:20 AM To: CF-Talk Subject: Re: Query Problem Weird. I had sent a query and it posted

Re: Query Problem

2006-11-06 Thread Craig Drabik
Use select distinct on the original query to eliminate duplicate records. I have a database of music CDs, something like: album - albumid int(10) unsigned NOT NULL auto_increment, albumtitle varchar(255), year smallint(5) unsigned track - trackid int(10) unsigned NOT

Re: Query Problem

2006-11-06 Thread Doug Brown
: Query Problem Adding the artistid to the album table would cause some SERIOUS redundant data... take Peeping Tom... there are at least 20 different artists on that album. Adding artistid to the album table would mean you needed to add the same album 20 times with a different artistid each

Re: Query Problem

2006-11-06 Thread Doug Brown
: Query Problem Adding the artistid to the album table would cause some SERIOUS redundant data... take Peeping Tom... there are at least 20 different artists on that album. Adding artistid to the album table would mean you needed to add the same album 20 times with a different artistid each time

Query Problem

2006-11-05 Thread Jim McAtee
I have a database of music CDs, something like: album - albumid int(10) unsigned NOT NULL auto_increment, albumtitle varchar(255), year smallint(5) unsigned track - trackid int(10) unsigned NOT NULL auto_increment, tracktitle varchar(255), tracknumber smallint(5)

relational query problem

2006-10-09 Thread Daniel Kessler
I have a table that has repair ticket information and another one that has information about technicians. The repair ticket column technician contains a number that references the ID in the technician database: tecnicians REFERENCES people_alt(people_alt_id) I query like this (see below)

relational query problem

2006-10-09 Thread jim
Daniel Kessler wrote .. Any advice on how to approach this is appreciated. Change it to a LEFT JOIN, which will always pull in the data from the repair_ticket table, and return NULL in the columns from people_alt if there is no match... CFQUERY NAME=getSelect DATASOURCE=dpch SELECT

Re: relational query problem

2006-10-09 Thread daniel kessler
oh man that worked GREAT! I suppose the issue is that with the left join, there is no dependency on the other database. It just joins the fields. I hope this is a lesson learned. thank a bunch - very hearty smile here... daniel Change it to a LEFT JOIN, which will always pull in the data

Re: Query problem with lists of values

2006-08-07 Thread Tom Chiverton
On Friday 04 August 2006 17:19, Kris Jones wrote: (which just doesn't work at all) It was meant to be in a loop. O(N), of course, but that's not so bad with only a few cats. Going with a linking table is probably the right way to go. Better performance too. Very, very, much the +1'ness :-)

Re: Query problem with lists of values

2006-08-07 Thread Casey Dougall
You can turn this SELECT catid FROM deep_images WHERE catid LIKE '#uid#' OR catid LIKE '#UID#,%' OR catid LIKE '%,#UID#' OR catid LIKE '%,#UID#,%' INTO this and it should do what your looking to do. SELECT catid FROM deep_images WHERE 0=0 AND (catid = '#uid#' OR

Re: Query problem with lists of values

2006-08-04 Thread Tom Chiverton
On Thursday 03 August 2006 18:43, Kris Jones wrote: SELECT catid FROM deep_images WHERE #uid# IN (catid) IN is evil. It will randomly stop working when you hit the db's limit for items in a string list. Which is not fun :-) If you must have comma lists rather than a more sensible layout, why

RE: Query problem with lists of values

2006-08-04 Thread Bobby Hartsfield
- From: Tom Chiverton [mailto:[EMAIL PROTECTED] Sent: Friday, August 04, 2006 9:30 AM To: CF-Talk Subject: Re: Query problem with lists of values On Thursday 03 August 2006 18:43, Kris Jones wrote: SELECT catid FROM deep_images WHERE #uid# IN (catid) IN is evil. It will randomly stop

Re: Query problem with lists of values

2006-08-04 Thread Kris Jones
but one item has entries of 15,16,30,49,50,52,75 and it is being put in a catecory that has the id of 2 there are lots of these that are behaving this way. any one think of a way to help with this? SELECT catid FROM deep_images WHERE #uid# IN (catid) IN is evil. It will randomly stop

Query problem with lists of values

2006-08-03 Thread Patrick Forsythe
here is the problem again I have a sql server with cold fusion mx my database has a field for categories it contains a comma delim list of categories to which each product belongs the prob is when I try to create a drop down list for them it is giving me all kinds of weird results. cfquery

RE: Query problem with lists of values

2006-08-03 Thread Ian Skinner
but one item has entries of 15,16,30,49,50,52,75 and it is being put in a category that has the id of 2 there are lots of these that are behaving this way. any one think of a way to help with this? This is happening of course because two of your like clauses catid LIKE '#uid#' AND catid LIKE

Re: Query problem with lists of values

2006-08-03 Thread Kris Jones
How about: SELECT catid FROM deep_images WHERE #uid# IN (catid) Cheers, Kris but one item has entries of 15,16,30,49,50,52,75 and it is being put in a category that has the id of 2 there are lots of these that are behaving this way. any one think of a way to help with this?

Re: Query problem with lists of values

2006-08-03 Thread Patrick Forsythe
that is kind of what I thought, but is there any way around this? This is happening of course because two of your like clauses catid LIKE '#uid#' AND catid LIKE '#uid#,' means that the 2 will match the 2 in '52,'. This is the difficulty with this kind of set up. -- Patrick Forsythe Tech

Re: Query problem with lists of values

2006-08-03 Thread Patrick Forsythe
Kris Jones wrote: How about: SELECT catid FROM deep_images WHERE #uid# IN (catid) Cheers, Kris I had tried that originally and sql server didn't like that much at all -- Patrick Forsythe Tech Support Smallville Communications http://www.toto.net Guter Rat ist teuer. --Unbekannt

RE: Query problem with lists of values

2006-08-03 Thread Josh Adams
Why don't you use a join table via which to associate your items and categories? Josh -Original Message- From: Patrick Forsythe [mailto:[EMAIL PROTECTED] Sent: Thursday, August 03, 2006 1:47 PM To: CF-Talk Subject: Re: Query problem with lists of values that is kind of what I thought

RE: Query problem with lists of values

2006-08-03 Thread Mark A Kruger
03, 2006 12:49 PM To: CF-Talk Subject: Re: Query problem with lists of values Kris Jones wrote: How about: SELECT catid FROM deep_images WHERE #uid# IN (catid) Cheers, Kris I had tried that originally and sql server didn't like that much at all -- Patrick Forsythe Tech Support Smallville

Re: Query problem with lists of values

2006-08-03 Thread Jim Wright
On 8/3/06, Mark A Kruger [EMAIL PROTECTED] wrote: Patrick, You can create a UDF that allows for list functions. Here's blog post on the topic. http://mkruger.cfwebtools.com/index.cfm?mode=entryentry=87616A7F-D611-F201- A72DB4B567CFA1F7 The UDF that Mark is blogging about looks like it

Re: Query problem with lists of values

2006-08-03 Thread Patrick Forsythe
the category information is in a seperate row these are only the uid s that are stored with the product. Jim Wright wrote: The UDF that Mark is blogging about looks like it will get you what you want, but do keep in mind that if you use a UDF like this in the WHERE clause, it will be executed

Re: Query problem with lists of values

2006-08-03 Thread Jim Wright
On 8/3/06, Patrick Forsythe [EMAIL PROTECTED] wrote: the category information is in a seperate row these are only the uid s that are stored with the product. Understood...but what you need is an intermediate table which links the two...something like... category table: uid description

RE: ARGH! - Three Months in the future query problem

2006-05-18 Thread Adrian Lynch
You might want to test the boundary cases because the time portion of datetimes can cause trouble for you. Adrian -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: 18 May 2006 05:28 To: CF-Talk Subject: Re: ARGH! - Three Months in the future query problem Duh

Re: ARGH! - Three Months in the future query problem

2006-05-18 Thread Jim McAtee
PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, May 17, 2006 10:28 PM Subject: Re: ARGH! - Three Months in the future query problem Duh! This does it: WHERE event_date #threemonths# and event_date = #startDATE# See! Getting away from the computer and thinking about

Re: ARGH! - Three Months in the future query problem

2006-05-18 Thread Jim McAtee
Mizzell [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, May 17, 2006 10:28 PM Subject: Re: ARGH! - Three Months in the future query problem Duh! This does it: WHERE event_date #threemonths# and event_date = #startDATE# See! Getting away from the computer

ARGH! - Three Months in the future query problem

2006-05-17 Thread Les Mizzell
OK, starting with January through September - this works great. It pulls up the current month and the next three months worth of events. cfset startDATE = #now()# cfset threemonths = DateAdd(m,3,startDATE) cfquery name=calendar SELECT id, event_date, event_name FROM events WHERE

Re: ARGH! - Three Months in the future query problem

2006-05-17 Thread Tony
why not try a BETWEEN '' and '' where you fill the '' and '' with the REAL dates... that will get everything in between, and the ones that are directly on the date. rather than just looking at the month, since 1 is less than 12 you can do the between, which follows date rules. tw On 5/17/06,

Re: ARGH! - Three Months in the future query problem

2006-05-17 Thread Les Mizzell
Duh! This does it: WHERE event_date #threemonths# and event_date = #startDATE# See! Getting away from the computer and thinking about things while walking your dogs really helps!! cfset startDATE = #now()# cfset threemonths = DateAdd(m,3,startDATE) cfquery name=calendar SELECT

RE: Query Problem - sorting

2006-03-10 Thread Dennis Powers
: Michael T. Tangorre [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 10:40 PM To: CF-Talk Subject: RE: Query Problem - sorting From: Dennis Powers [mailto:[EMAIL PROTECTED] SELECT FilesCategory.Cat_Name, Avg(Comments.Numeric1) AS Userrating, Count(Comments.Numeric1

Query Problem - sorting

2006-03-08 Thread Dennis Powers
I am hoping some one can asset me with obtaining the proper sorting for this aggregate query. I just can't see it. Basically I wish to sort by Userrating, but only on records that have a Responses count greater that 8. SELECT FilesCategory.Cat_Name, Avg(Comments.Numeric1) AS

RE: Query Problem - sorting

2006-03-08 Thread Michael T. Tangorre
From: Dennis Powers [mailto:[EMAIL PROTECTED] SELECT FilesCategory.Cat_Name, Avg(Comments.Numeric1) AS Userrating, Count(Comments.Numeric1) AS Responses FROM (FilesData LEFT JOIN Comments ON FilesData.ID = Comments.LinkID) LEFT JOIN FilesCategory ON

Re: query problem

2005-09-29 Thread daniel kessler
[empty string] is CF's way of saying NULL, since ColdFusion has not native NULL value. Thus your where clause should be WHERE Publication_Type IS NOT NULL didn't work, but this did. Interestingly, != NULL didn't work. It had to be IS NOT NULL I never would have gotten this. I was thinking

query problem

2005-09-28 Thread Daniel Kessler
I can't seem to see what is wrong with this query. I added the WHERE line and it comes up with no records returned. Without the WHERE, it comes up with two records, but one of them has publication_type as an empty field. I know there are records that aren't empty. Here's the query:

RE: query problem

2005-09-28 Thread Ian Skinner
[empty string] is CF's way of saying NULL, since ColdFusion has not native NULL value. Thus your where clause should be WHERE Publication_Type IS NOT NULL -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! -

Re: query problem

2005-09-28 Thread Ryan Guill
not equals in sql is , that may help On 9/28/05, Daniel Kessler [EMAIL PROTECTED] wrote: I can't seem to see what is wrong with this query. I added the WHERE line and it comes up with no records returned. Without the WHERE, it comes up with two records, but one of them has publication_type

RE: query problem

2005-09-28 Thread Tangorre, Michael
From: Daniel Kessler [mailto:[EMAIL PROTECTED] CFQUERY NAME=the_type DATASOURCE=dpch select publication_type from publications where publication_type !='' group by publication_type /CFQuery If the field is NOT NULL try, where LEN(TRIM(publication_type)) == 0 *note...

Re: query problem

2005-09-28 Thread Claude Schneegans
In case the default value returned by the db is an empty string, you may need the belt and the suspenders: where NOT (publication_type IS NULL OR publication_type = '') -- ___ REUSE CODE! Use custom tags; See

Re: Query Problem - Brain Cloud

2005-08-05 Thread Doug Bedient
CAN YOU FIIP/FLOP VARIABLES AND DATA IN CF? This works in the SQL Query Analyzer. Is there a way to switch it to CF? When I run it I get the following error. [SQLServer JDBC Driver][SQLServer]Invalid column name 'DateFrom'. Because DateFrom is a passed variable. Select * RENTALS r Where NOT

Re: Query Problem - Brain Cloud

2005-08-04 Thread Doug Bedient
Impressive use of your noggin. Hopefully I can explain my problem a little better. I have changed my data import to create a date record for every night. Instead of the arrival date and number of nights. I can easily change back it this doesn't provide the results the best way. Below is some

Re: Query Problem - Brain Cloud

2005-07-29 Thread Chris Terrebonne
This looks like a good use of a Tally table. A Tally table is a table that contains just an ID field with records from 1 to 10,000 (you can use any upper bound you need). You can then join this table to generate queries based on ranges. To test, I created the following table: ID int

Query Problem - Brain Cloud

2005-07-28 Thread Doug Bedient
I have 2 tables, one lists properties and the other contains arrival dates and number of nights for those properties. The common variable is 'unitCode'. The search parameters provide an arrival date and departure date. My question. How would you use the arrival date/number of nights to locate

Re: Query Problem - Brain Cloud

2005-07-28 Thread Jennifer Larkin
Change it so it has an arrival date and a departure date? :D On 7/28/05, Doug Bedient [EMAIL PROTECTED] wrote: I have 2 tables, one lists properties and the other contains arrival dates and number of nights for those properties. The common variable is 'unitCode'. The search parameters

Re: Query Problem - Brain Cloud

2005-07-28 Thread Doug Bedient
I would still have dates between the arrival date and newly created departure date that would need to be handled somehow. Originally, I had looping set up to create a record for every date but it seemed like a lot of extra processing that shouldn't be required.

Re: Query Problem - Brain Cloud

2005-07-28 Thread Barney Boisvert
I don't think you can do it in a single SQL statement. At least not an efficient one. How about pull the list of reservations that overlap the desired dates, and then creating an array of dates (from arrival to departure), and then loop over the recordset and remove dates from the array that are

RE: Query Problem - Brain Cloud

2005-07-28 Thread Dave.Phillips
Can you not use the SQL operator BETWEEN? where thedate BETWEEN arrivaldate AND departuredate ? -Original Message- From: Doug Bedient [mailto:[EMAIL PROTECTED] Sent: Thursday, July 28, 2005 2:47 PM To: CF-Talk Subject: Re: Query Problem - Brain Cloud I would still have dates between

Re: Query Problem - Brain Cloud

2005-07-28 Thread Greg Morphis
Add a vacant field and check to see if vacant is 0 or 1 0 being not vacant and 1 being vacant? But the where clause would look something like Select * from task t WHERE TO_DATE('#arguments.new_to#','mm/dd/') = t.startDate AND TO_DATE('#arguments.new_from#','mm/dd/') = t.finishDate

RE: Query Problem - Brain Cloud

2005-07-28 Thread Ian Skinner
, July 28, 2005 11:47 AM To: CF-Talk Subject: Re: Query Problem - Brain Cloud I would still have dates between the arrival date and newly created departure date that would need to be handled somehow. Originally, I had looping set up to create a record for every date

Re: Query Problem - Brain Cloud

2005-07-28 Thread Jennifer Larkin
Something like this wouldn't handle them where arrivaldate = #arrivaldate# and departuredate = #departuredate# ? Maybe I don't understand what you are trying to do? On 7/28/05, Doug Bedient [EMAIL PROTECTED] wrote: I would still have dates between the arrival date and newly created departure

Re: Query Problem - Brain Cloud

2005-07-28 Thread Jennifer Larkin
? where thedate BETWEEN arrivaldate AND departuredate ? -Original Message- From: Doug Bedient [mailto:[EMAIL PROTECTED] Sent: Thursday, July 28, 2005 2:47 PM To: CF-Talk Subject: Re: Query Problem - Brain Cloud I would still have dates between the arrival date and newly created

Re: Query Problem - Brain Cloud

2005-07-28 Thread Barney Boisvert
here's a timeline in days (if you don't have fixed-width font, CP into something that does): 123456789 xxx reservation 1 xxx reservation 2 x reservation 3 q desired range there are two possible days available: 4 and 6. That's the problem he's trying to solve.

Re: Query Problem - Brain Cloud

2005-07-28 Thread Jeff Congdon
Then you need a reference table of dates, so you can query what IS NOT there. You can hit this table like this: select date from datetable where date BETWEEN x AND y and date NOT IN (select distinct date from reservation where date between x AND y) right? -jc Barney Boisvert wrote:

Re: Query Problem - Brain Cloud

2005-07-28 Thread Jochem van Dieten
Doug Bedient wrote: I have 2 tables, one lists properties and the other contains arrival dates and number of nights for those properties. The common variable is 'unitCode'. The search parameters provide an arrival date and departure date. My question. How would you use the arrival

Array access/query problem

2005-07-14 Thread Merrill, Jason
I am using Flash remoting to send an array to a CFC - works fine, until I try a query. I have been able to connect to the datasource and retrieve values in another CFC with no problem. Why am I getting a Error Executing Database Query error in Flash? The part that I don't understand is how to

RE: Array access/query problem

2005-07-14 Thread Dave Watts
I am using Flash remoting to send an array to a CFC - works fine, until I try a query. I have been able to connect to the datasource and retrieve values in another CFC with no problem. Why am I getting a Error Executing Database Query error in Flash? The part that I don't understand

RE: Array access/query problem

2005-07-14 Thread Merrill, Jason
| icfconsulting.com -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 3:24 PM To: CF-Talk Subject: RE: Array access/query problem I am using Flash remoting to send an array to a CFC - works fine, until I try a query. I have been able

RE: Array access/query problem

2005-07-14 Thread Merrill, Jason
Thanks Dave! Now I'm on to this: Any info on using Remoting to send complex data types to a CFC? i.e. From Flash: myObj:Object = {data:[{count:23, title:Bananas}, {count:10, title:Apples}]}; Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the

RE: Query Problem.

2005-07-13 Thread James Smith
SELECT max(stockid) as stockid, data1, data2 FROM table HAVING data1 = 5 Unfortunately this is returning the following data StockID | Data1 | Data2 --- 3 | 5 | 2 Ie: the correct stockid and data1 but data2 from a diferent row!

Query Problem.

2005-07-11 Thread James Smith
I have a problem I am sure is simple to solve but it has proved to be beyond me. Imagine I have the following data... StockID | Data1 | Data2 --- 1 | 1 | 2 2 | 3 | 4 3 | 5 | 6 And I want a query to return StockID | Data1 | Data2

  1   2   3   4   >