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

Re: SQL query question

2011-02-02 Thread Sean Henderson
With ColdFusion 9, we ended up replacing all the wildcard selects with actual column names, among other fortifications. We did not experience this issue on 6.1. ~| Order the Adobe Coldfusion Anthology now!

Re: SQL query question

2011-02-01 Thread Charlie Stell
This might be an issue I've had to deal with before. Do something to change the fingerprint (no idea what the correct term would be) of the query - or restart cf. By change the fingerprint, it could be something as simple ad swapping p.* and pt.* (swapping as in their ordinal position in the

Re: SQL query question

2011-02-01 Thread Ian Skinner
On 2/1/2011 1:23 PM, Debbie Morris wrote: What am I overlooking? The evil of using * in SELECT clauses. When that is done, database drivers are know to cache the columns and datatypes of the SQL queries. Then somebody comes along and changes the database structure, like you adding a field.

Re: SQL query question

2011-02-01 Thread Ian Skinner
On 2/1/2011 2:21 PM, Charlie Stell wrote: I assume this is something on CF's side - as restarting the CF service also fixes it. Not ColdFusion itself, but the database drivers used by ColdFusion and the cached (pooled) data source settings. Changing the Datasource to not used pooled settings

Re: SQL query question

2011-02-01 Thread Michael Grant
The evil of using * in SELECT clauses. I'm with Ian on this 100%. Often times developers think that using * will be faster, and easier and allow more flexibility. However that couldn't be further from the truth as you are seeing now. Take Ian's advice and define each column you want from your

RE: SQL query question

2011-02-01 Thread Debbie Morris
, so I'll tackle this again in the morning. Thanks for the help! Debbie -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: Tuesday, February 01, 2011 5:41 PM To: cf-talk Subject: Re: SQL query question The evil of using * in SELECT clauses. I'm with Ian on this 100

RE: SQL query sorting problem

2009-01-26 Thread Dawson, Michael
The proper solution would be a separate table that contains the state codes with their desired sort order. That table is joined to the main table. This is probably best if you have to list all 50+ states. If you only need to list three states, then I would use CASE as Azadi suggested. In

Re: SQL query sorting problem

2009-01-26 Thread Chris Blackwell
DBMS is MySQL 5. I have a report that is generated for cities within several states. The states are designated by their two letter postal abbreviations and are in a certain order. For example: 1. NY 2. CA 3. FL I would like the records of the report sorted by the original state order, then

Re: SQL query sorting problem

2009-01-26 Thread Azadi Saryev
Mike, the way i read OP's question is that the order of states is not fixed, but user-defined: i.e. a user selects several states in several select lists and the data returned must be in the order of selected states. but in case of pre-defined order of states, your suggestion will be perfect.

Re: SQL query sorting problem

2009-01-26 Thread Azadi Saryev
that's very neat, chris! i didn't think one could use FIND_IN_SET in ORDER BY clause - live and learn! Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Chris Blackwell wrote: You can do this in a very easy and elegant manner with MySQL. No need for join or nasty case statements SELECT *

Re: SQL query sorting problem

2009-01-26 Thread Jim McAtee
Michael, Thanks. That worked perfectly. Jim - Original Message - From: Dawson, Michael m...@evansville.edu To: cf-talk cf-talk@houseoffusion.com Sent: Monday, January 26, 2009 8:07 AM Subject: RE: SQL query sorting problem The proper solution would be a separate table that contains

Re: SQL query sorting problem

2009-01-25 Thread Azadi Saryev
rty a UNION query generated inside a cfloop: cfquery ... cfloop from=1 to=#listlen(states)# index=j (SELECT *, #j# AS sortcol FROM cities WHERE state = '#listgetat(states, j)#') cfif j lt listlen(states)UNION /cfif /cfloop ORDER BY sortcol, city /cfquery you could also probably build a dynamic

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

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: SQL query with LIMIT option

2007-10-10 Thread Tom Chiverton
On Wednesday 10 Oct 2007, [EMAIL PROTECTED] wrote: i want to create a SQL query with a LIMIT option but it will produce an error. What error ? On what database ? -- Tom Chiverton Helping to proactively iterate scalable markets on: http://thefalken.livejournal.com

Re: SQL query with LIMIT option

2007-10-10 Thread Jochem van Dieten
Stivn .. wrote: i want to create a SQL query with a LIMIT option but it will produce an error. What is the correct syntax for a SQL query with LIMIT option That depends on your database. With MS databases you need to use TOP, with Oracle rownum, with MySQL and PostgreSQL LIMIT. The syntax

RE: SQL Query Help

2007-04-05 Thread jennygw
thanks to everyone who replied, problem solved. Jenny -Original Message- From: Rafael Marquez [mailto:[EMAIL PROTECTED] Sent: 04 April 2007 21:06 To: CF-Talk Subject: RE: SQL Query Help Well, it's not a brain fart. That query is kinda kinky. Use this as an example, replacing your

RE: SQL Query Help

2007-04-04 Thread Ben Nadel
Maybe something like this (which I cannot test): SELECT c.id, c.name, i.* FROM customer c LEFT OUTER JOIN ( -- Get max (most recent) id (assuming pkey) of -- each invoice as grouped by client.

RE: SQL Query Help

2007-04-04 Thread Dawson, Michael
Assuming the invoice numbers increase each time, you can use MAX() and GROUP BY to get what you need. SELECT customer, MAX(invoiceNum) AS lastNum FROM table GROUP BY customer If invoices are not numbered sequentially, hopefully you have a date field that you can add to the grouping. M!ke

RE: SQL Query Help

2007-04-04 Thread Gaulin, Mark
Need more info: What would the query be to return the last invoice for a single customer? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 8:58 AM To: CF-Talk Subject: SQL Query Help having brain fart here ... ughh scenario:

RE: SQL Query Help

2007-04-04 Thread Rafael Marquez
(T.Deleted = 0) AND (T.Status 'Pending') AND (T.AccountType = 'Customer') GROUP BY T.CustomerID, T.TransactionDate, T.ID Hope this helps. -Original Message- From: Gaulin, Mark [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 3:39 PM To: CF-Talk Subject: RE: SQL Query Help

Re: sql query help

2007-02-05 Thread Jim Wright
Mik Muller wrote: select left(datetime,11), count(*) as dt from sitelog where datetime = '2007-02-03 00:00' group by left(datetime,11) order by left(datetime,11) desc Well, now that I look at it, the order by is ordering by jan 1 2006 etc in

Re: sql query help

2007-02-05 Thread Mik Muller
This is how I'm doing it for now... select count(*) as dt cfif url.stats eq bar-day, left(datetime,11) as datetime/cfif from sitelog where datepart(year,datetime) = '#theyear#' and datepart(month,datetime) = '#themonth#' cfif listLen(url.datestat,/) eq 2 and datepart(year,datetime) =

Re: SQL Query

2007-01-11 Thread gert franz
Hi Pete, could it be that one of the advertisers is in more than one category? Just dump the query and look at the repeating entries. There will be some of the columns that change from record to record. Even though you think they are identical. Gert  Hi there    I have a query that I have

RE: SQL query to get first sentence (using mySQL)

2006-01-10 Thread Andy Matthews
Anyone have ideas on this? !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Monday, January 09, 2006 9:35 AM To: CF-Talk Subject: SOT:

RE: SQL query to get first sentence (using mySQL)

2006-01-10 Thread Adrian Lynch
Outside of a query you could do something like... - Loop through all your delimiters getting the first index of each. So . may be at index 29, ! at index 40 and ? at index 18. - Use the lowest one in your query below to denote the end of the first sentence. In a query, how about... - Replace

Re: SQL query help needed

2005-06-16 Thread Jochem van Dieten
Elena Aminova wrote: id DateQty Dollars 1605/30/2003 4 890.00 2707/28/2004 1 300.00 2901/17/2003 4 108.00 5501/21/2002 1 105.00 5609/20/2003 7 700.00 5609/16/2003 0 0.00 56

Re: SQL Query Question

2005-05-22 Thread Jochem van Dieten
Ewok wrote: this is by far the easiest way to link tables. No... It’s the only way to link tables that's why we do it. Not at all, you can link tables in many ways: you just have to do it all by hand instead of using the features that are provided by the database. It seems that you are

Re: SQL Query Question

2005-05-22 Thread Jochem van Dieten
S.Isaac Dealey wrote: I would expect in this case that having a primary key on the table he described wouldn't change the sql syntax much (if at all). It wouldn't change the syntax at all. For all we know it has a primary key and if not, how about the following one: ALTER TABLE ADD PRIMARY

RE: SQL Query Question

2005-05-22 Thread Ewok
, May 22, 2005 3:10 AM To: CF-Talk Subject: Re: SQL Query Question Ewok wrote: this is by far the easiest way to link tables. No... It’s the only way to link tables that's why we do it. Not at all, you can link tables in many ways: you just have to do it all by hand instead of using

RE: SQL Query Question

2005-05-21 Thread S . Isaac Dealey
My impression from his description was that the actID was a sequential number associated with the crID so in his case he would always know that there would be only one record with a given actID for any given crID which is a foreign key to another table -- and as he wanted all data on that row,

Re: SQL Query Question

2005-05-21 Thread Jochem van Dieten
Ewok wrote: Use distinct and order descending by crid. In the future, I highly recommend a unique key (PK) or at least a date/time field to decide which are the latest records The datamodel is fine, crID and actID function nicely as composite primary key. Jochem

RE: SQL Query Question

2005-05-21 Thread Ewok
How so with duplicates of both? -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Saturday, May 21, 2005 10:13 AM To: CF-Talk Subject: Re: SQL Query Question Ewok wrote: Use distinct and order descending by crid. In the future, I highly recommend a unique key

RE: SQL Query Question

2005-05-21 Thread Ewok
# /cfoutput /pre -Original Message- From: Ewok [mailto:[EMAIL PROTECTED] Sent: Friday, May 20, 2005 10:40 PM To: CF-Talk Subject: RE: SQL Query Question Use distinct and order descending by crid. In the future, I highly recommend a unique key (PK) or at least a date/time field to decide

Re: SQL Query Question

2005-05-21 Thread Jochem van Dieten
Ewok wrote: How so with duplicates of both? Because combined they are a unique identifier. Jochem ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours

RE: SQL Query Question

2005-05-21 Thread Ewok
having trouble with would be less trouble than it' already not if they existed here. -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Saturday, May 21, 2005 2:41 PM To: CF-Talk Subject: Re: SQL Query Question Ewok wrote: How so with duplicates of both? Because

Re: SQL Query Question

2005-05-21 Thread Jochem van Dieten
Ewok wrote: I guess that痴 one way of looking at it... I think creating the need to combine them is more work than its worth or would ever need to be. Valid or invalid, I still recommend something a little more easier to differentiate records with such as a single unique key per record. I

RE: SQL Query Question

2005-05-21 Thread Ewok
van Dieten [mailto:[EMAIL PROTECTED] Sent: Saturday, May 21, 2005 6:27 PM To: CF-Talk Subject: Re: SQL Query Question Ewok wrote: I guess that痴 one way of looking at it... I think creating the need to combine them is more work than its worth or would ever need to be. Valid or invalid, I still

RE: SQL Query Question

2005-05-21 Thread S . Isaac Dealey
If your not getting uptight... I'll drop it here anyway because... well... pro-longed exposure to me tends to make people that way :) Droids don't tear peoples arms out of their sockets if they... oh nevermind... :) s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add

RE: SQL Query Question

2005-05-21 Thread S . Isaac Dealey
After all, what hes having trouble with would be less trouble than it' already not if they existed here. I would expect in this case that having a primary key on the table he described wouldn't change the sql syntax much (if at all). I still like to have a primary key on these sorts of tables,

RE: SQL Query Question

2005-05-21 Thread Ewok
. Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: Saturday, May 21, 2005 8:04 PM To: CF-Talk Subject: RE: SQL Query Question After all, what hes having trouble with would be less trouble than it' already not if they existed here. I would expect in this case that having a primary key on the table he

RE: SQL Query Question

2005-05-21 Thread S . Isaac Dealey
True, more would be helpful. But a unique identifier would serve the purpose of deciding which was entered last which I believed he asked... but only he could clarify that and since he's not responding with any input... :) you calling Jochem a wookie? hehe Actually it was a mangled

RE: SQL Query Question

2005-05-20 Thread Ewok
Use distinct and order descending by crid. In the future, I highly recommend a unique key (PK) or at least a date/time field to decide which are the latest records -Original Message- From: Jeff Chastain [mailto:[EMAIL PROTECTED] Sent: Friday, May 20, 2005 9:59 AM To: CF-Talk Subject: OT:

RE: SQL/Query exestuation plans

2005-02-16 Thread RADEMAKERS Tanguy
1) if it doesn't exist yet, create a plan table in your schema. You can do this by running the script $ORACLE_HOME/rdbms/admin/utlxplan.sql 2) use the EXPLAIN PLAN command: EXPLAIN PLAN SET STATEMENT_ID = 'sampleplan' FOR select count(*) from blobtest;

RE: SQL Query Question

2005-01-07 Thread Ian Skinner
Others will probably come up with a better way, but my first thought was a series of unions. SELECT DISTINCT values FROM ( SELECT DISTINCT v1 AS values FROM table UNION SELECT DISTINCT v2 AS values FROM table UNION SELECT

RE: SQL Query Question

2005-01-07 Thread Dennis Powers
Ian, Thanks!!! That put me on the right track. I had never used a Union before and didn't even think about it. The resultant query looks like: SELECT DISTINCT v1 AS V_values FROM table UNION SELECT DISTINCT v2 AS V_values FROM table UNION

Re: SQL Query matching dates

2005-01-04 Thread Jochem van Dieten
Duncan I Loxton wrote: SELECT * FROM LibraryBooking WHERE lib_item = #attributes.lii_id# AND ( (lib_StartDate = #startDate# AND lib_StartDate = #startDate#) OR (lib_EndDate = #endDate# AND lib_EndDate = #endDate#)

Re: SQL Query

2004-12-10 Thread Jochem van Dieten
Jason Smith wrote: This code works fine with a access database, since converting the entire cf application to a live SQL database it has been the beginning of a nightmare. I'm not real familiar with access but it seems they have some really strange ways to check dates and whatnot. table

Re: SQL Query

2004-12-10 Thread Cliff Meyers
On Fri, December 10, 2004 2:44 pm, Jason Smith said: This code works fine with a access database, since converting the entire cf application to a live SQL database it has been the beginning of a nightmare. I'm not real familiar with access but it seems they have some really strange ways to

Re: SQL Query

2004-12-10 Thread Jason Smith
After some work and some more work I have the administration side of the cold fusion application working correctly but now when I am adding a product I have come across a problem that appears to be with how the query in access worked vs sql. The following is the query if anyone has any ideas

Re: SQL Query question. Please help...

2004-11-30 Thread Adam Haskell
Multiple ways heres one: SELECT CustID FROMCustomers WHERE CustID NOT IN (Select CustID From Orders) Adam On Tue, 30 Nov 2004 12:01:30 -0500, Che Vilnonis [EMAIL PROTECTED] wrote: Say I have two simple queries: cfquery name=getCustsFromCusts datasource=#DSN# SELECT CustID FROM

RE: SQL Query question. Please help...

2004-11-30 Thread Katz, Dov B (IT)
How about this? Select CustID from customers where custID not in (select custid from orders) -dov -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 12:01 PM To: CF-Talk Subject: SQL Query question. Please help... Say I have two simple

RE: SQL Query question. Please help...

2004-11-30 Thread Eric Creese
Sometimes using NOT can have performance issues You can also do: SELECT a.CustID FROMCustomers a,Orders b WHERE a.CustID = b.CustID -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 11:06 AM To: CF-Talk Subject: Re: SQL Query question

RE: SQL Query question. Please help...

2004-11-30 Thread Eric Creese
, November 30, 2004 11:05 AM To: CF-Talk Subject: RE: SQL Query question. Please help... Sometimes using NOT can have performance issues You can also do: SELECT a.CustID FROMCustomers a,Orders b WHERE a.CustID = b.CustID -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent

Re: SQL Query question. Please help...

2004-11-30 Thread Greg Morphis
-Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 11:06 AM To: CF-Talk Subject: Re: SQL Query question. Please help... Multiple ways heres one: SELECT CustID FROMCustomers WHERE CustID NOT IN (Select CustID From Orders) Adam On Tue, 30

Re: SQL Query question. Please help...

2004-11-30 Thread Adam Haskell
You can also do: SELECT a.CustID FROMCustomers a,Orders b WHERE a.CustID = b.CustID -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 11:06 AM To: CF-Talk Subject: Re: SQL Query question. Please help... Multiple ways

RE: SQL Query question. Please help...

2004-11-30 Thread Che Vilnonis
Adam/Dov Using your query my recordcount is off. Actual # of customer ids from my customers table = 865. Actual # of customer ids from my orders table = 596. Using your query, the difference = 335. 865 - 596 should = 269. What am I missing? Debug info is below.

Re: SQL Query question. Please help...

2004-11-30 Thread Adam Haskell
Under your math you are assuming a 1 to 1 relationship between orders and Custromers. Unless you are running a scam, where no customer would ever by from you twice, that is not case, the whole reason you have 2 seperate tables. Hope thats makes sense. Adam H On Tue, 30 Nov 2004 12:18:23 -0500,

RE: SQL Query question. Please help...

2004-11-30 Thread Dave Francis
You have multiple Orders for some customers. What is count for: SELECT DISTINCT Custid from Orders -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 12:18 PM To: CF-Talk Subject: RE: SQL Query question. Please help... Adam/Dov

RE: SQL Query question. Please help...

2004-11-30 Thread Che Vilnonis
I see. Haven't had my lunch yet. Thanks for your help. Che -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 12:23 PM To: CF-Talk Subject: Re: SQL Query question. Please help... Under your math you are assuming a 1 to 1 relationship

Re: SQL Query question. Please help... HA!

2004-11-30 Thread Anders Green
At 12:22 PM 11/30/2004, Adam Haskell wrote: Under your math you are assuming a 1 to 1 relationship between orders and Custromers. Unless you are running a scam, where no customer would ever by from you twice, that is not case, the whole reason you have 2 seperate tables. Hope thats makes sense.

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread Andy Mcshane
Thanks for this, it is really a great help, I may get a good nights sleep now! -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: 18 November 2004 19:50 To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion Here

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread Andy Mcshane
This is excellent, can't believe it could be so simple! Why didn't I think of that? Many thanks. -Original Message- From: Rob [mailto:[EMAIL PROTECTED] Sent: 18 November 2004 19:14 To: CF-Talk Subject: Re: SQL Query using 'FOR XML' Coldfusion http://216.239.57.104/search?q

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread Andy Mcshane
Thanks for this, it is really a great help, I may get a good nights sleep now! -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: 18 November 2004 19:50 To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread Andy Mcshane
Thanks for this, it is really a great help, I may get a good nights sleep now! -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: 18 November 2004 19:50 To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion Rob, quick query, when I use the following code

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread COLLIE David
'Document root element is missing' any idea why? I think the xml should be something like this, root itemsomething1/item itemsomething2/item itemsomething3/item itemsomething4/item /root which it doesn't look like it is... Ie the only element is the root one

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-19 Thread Rob
:[EMAIL PROTECTED] Sent: 18 November 2004 19:50 To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion Rob, quick query, when I use the following code cfxml variable=xmldoc root cfloop from=1 to=#xmltest.recordcount# index=xcfoutput#xmltest[xmltest.columnlist][x]#/cfoutput/cfloop

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Andy McShane
Can you remember at all how you handled the column names? i.e. 'XML_F52E2B61-18A1-11D1-B105-00805F49916B'. -Original Message- From: Rob [mailto:[EMAIL PROTECTED] Sent: 17 November 2004 17:42 To: CF-Talk Subject: Re: SQL Query using 'FOR XML' Coldfusion Yes, you have to loop over

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Taco Fleur
November 2004 8:27 PM To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion Can you remember at all how you handled the column names? i.e. 'XML_F52E2B61-18A1-11D1-B105-00805F49916B'. -Original Message- From: Rob [mailto:[EMAIL PROTECTED] Sent: 17 November 2004 17

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Andy Mcshane
Email: mailto:[EMAIL PROTECTED] Website: www.scout7.com -Original Message- From: Taco Fleur [mailto:[EMAIL PROTECTED] Sent: 18 November 2004 12:58 To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion The only way I found to do this is actually get an ADO stream, I wrote an SP

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Rob
handled the column names? i.e. 'XML_F52E2B61-18A1-11D1-B105-00805F49916B'. -Original Message- From: Rob [mailto:[EMAIL PROTECTED] Sent: 17 November 2004 17:42 To: CF-Talk Subject: Re: SQL Query using 'FOR XML' Coldfusion Yes, you have to loop over the query columns and build

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Rob
November 2004 17:42 To: CF-Talk Subject: Re: SQL Query using 'FOR XML' Coldfusion Yes, you have to loop over the query columns and build a new string with the columns data. The way you go about it is pretty wacky and I forget the syntax, but I (and others) have posted how to do

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Lawrence Ng
u know we're getting old when we forget the time... LOL ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184801

RE: SQL Query using 'FOR XML' Coldfusion

2004-11-18 Thread Taco Fleur
November 2004 11:08 PM To: CF-Talk Subject: RE: SQL Query using 'FOR XML' Coldfusion Thanks, I am definitely interested! This would be of a great help to me. Andy McShane Head of Development Scout7 Ltd, 324a Lichfield Road, Mere Green, Sutton Coldfield West Midlands United

Re: SQL Query using 'FOR XML' Coldfusion

2004-11-17 Thread Rob
Yes, you have to loop over the query columns and build a new string with the columns data. The way you go about it is pretty wacky and I forget the syntax, but I (and others) have posted how to do it to the list at one point so it should be in the archive (it was like a year ago though) On Wed,

RE: SQL Query Help Please.

2004-10-12 Thread Cornillon, Matthieu (Consultant)
2.) Can someone please suggest a good book on SQL syntax that will clear thing up for me. Other beginner resources: 1) http://www.sqlcourse.com/ http://www.sqlcourse.com/ 2) http://sqlcourse2.com/ http://sqlcourse2.com/ 3) http://www.freeprogrammingresources.com/sql.html

Re: SQL Query Help Please.

2004-10-12 Thread Nomad
Thanks Umer Others, You guys have been of great help. Will try the query today.. Regards, Mark - Original Message - From: Umer Farooq [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, October 11, 2004 8:17 PM Subject: Re: SQL Query Help Please. Here you.. go.. returns

RE: SQL Query Help Please.

2004-10-12 Thread Al Everett
2.) Can someone please suggest a good book on SQL syntax Teach Yourself SQL in 10 Minutes by Ben Forta. ISBN 0-672-32128-9 ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com [Todays Threads] [This Message]

Re: SQL Query Help Please.

2004-10-11 Thread Umer Farooq
Hi, http://www.techonthenet.com/access/queries/joins1.htm For beginner I would suggest.. SAMS SQL in 21 Days.. and Google.. :-) Nomad wrote: Hello! I am trying to create a join of four tables to get data from a db in the format I want. The Database tables and fields are: Orders

Re: SQL Query Help Please.

2004-10-11 Thread Josh
Here's a start, though you'll have to explain your tables and your calculations further. SELECT c.Customername, a.Orderid, a.Orderdate, ( where is this being stored? AmountReceived maybe this could be d.PaymentReceivedAS AmountReceived ? ), ( put your formula for calculating AmountDue

  1   2   3   >