Ask a Question related to Coldfusion Database Access, Design and Development.
-
RuBot #1
Group By?? Group ID?? What do I do?
I have an Access table designed as follows:
branch name, name, account number, major type, minor type, status, balance,
date.
The 'major types' are the types of accounts. I need to find out who has an
account type of savings, but no checkings. Further queries are variations of
this first query.
For example records might look like
Denver, Bob, 11111, SAV, EFP, Active, 10.00, 9/27/05
Denver, Bob, 22222, CK, EFP, Active, 50.00, 09/22/05
Texas, Fred, 123123, SAV, EFP, Active, 1.00, 02/02/99
Danville, Dan, 312312, CK, EFP, Active, 12.01, 09.12.99
The query should see that only Fred has a savings account and not a checking
account, and this should be the only record displayed. How do I properly group
to test the conditional?
RuBot Guest
-
"group by" - order of rows in group
this is simple example: TABLE SCHEMA: create table my_table( id int unsigned not null auto_increment primary key, project varchar(255) not... -
May 29 Sydney Developers Group study group
On Monday 29th May, we'll be studying Actionscript 3. Please read the articles prior to the meeting (see <a target=_blank... -
cfgrid inside a <cfoutput query="myQuery" group="GROUP">
Is it possible to use a cfgrid inside a cfoutput with a query and a group. When I try do that I get the following error: INVALID_CHARACTER_ERR:... -
group
I've made a group called everyone. It has its own Sub-directory, "/home/everyone". I have 3 users in the group. Do I have to do anything else so... -
Hi to the group
X-No-Archive: Yes Hi, Been lurking for the most part and I thought posting every now and then, but realized that I had been throwing those out... -
Dan Bracuk #2
Re: Group By?? Group ID?? What do I do?
So far you don't have to group anything.
select * from the_table
where major_type = 'SAV'
and name not in
(select name from table
where major_type = 'CK')
By the way, the spaces in your tablenames will cause you more trouble than
they are worth. You should rename them.
Originally posted by: RuBot
I have an Access table designed as follows:
branch name, name, account number, major type, minor type, status, balance,
date.
The 'major types' are the types of accounts. I need to find out who has an
account type of savings, but no checkings. Further queries are variations of
this first query.
For example records might look like
Denver, Bob, 11111, SAV, EFP, Active, 10.00, 9/27/05
Denver, Bob, 22222, CK, EFP, Active, 50.00, 09/22/05
Texas, Fred, 123123, SAV, EFP, Active, 1.00, 02/02/99
Danville, Dan, 312312, CK, EFP, Active, 12.01, 09.12.99
The query should see that only Fred has a savings account and not a checking
account, and this should be the only record displayed. How do I properly group
to test the conditional?
Dan Bracuk Guest
-
RuBot #3
Re: Group By?? Group ID?? What do I do?
Actually the field names are a little confusing so I just wrote them out for
better understanding.
Here's my query, and here's my error message:
<cfquery name = "SavNoCk" datasource="TopAccounts">
select * from acctinfostripped
where mjaccttypcd = 'SAV'
and name not in
(select name from table where mjaccttypcd = 'CK')
</cfquery>
"Syntax error. in query expression 'mjaccttypcd = 'SAV' and name not in
(select name from table where mjaccttypcd = 'CK')"
RuBot Guest
-
paross1 #4
Re: Group By?? Group ID?? What do I do?
You didn't use the proper table name in your sub-select. Also, using a NOT
EXISTS may be more efficient.
<cfquery name = "SavNoCk" datasource="TopAccounts">
SELECT *
FROM acctinfostripped AS a
WHERE a.mjaccttypcd = 'SAV'
AND NOT EXISTS
(SELECT 1
FROM acctinfostripped AS a1
WHERE a1.mjaccttypcd = 'CK'
AND a1.name = a.name)
</cfquery>
Phil
paross1 Guest



Reply With Quote

