Hello,
I have a table that looks something like this.
Com1 genderfname lname
001 M Matt Smith
001 M Bill Wright
005 FKara Brown
005 M Mike White
What I need
You could do it with a subquery
select * from sometable a
WHERE a.gender = 'M'
AND lname = (SELECT max(lname) FROM foo WHERE com1=a.com1)
(of course, this assumes that lname is unique within a com1, which may
not be the case...you may need to add on a identity field to make sure
you only get
fixing my query...I had used used foo as the tablename originally, and
not changed it in both places...
select * from sometable a
WHERE a.gender = 'M'
AND lname = (SELECT max(lname) FROM sometable WHERE com1=a.com1)
--
Jim Wright
Wright Business Solutions
[EMAIL PROTECTED]
919-417-2257
May 2006 13:34
To: CF-Talk
Subject: Possible in SQL?
Hello,
I have a table that looks something like this.
Com1 genderfname lname
001 M Matt Smith
001 M Bill Wright
005 FKara Brown
005
: Monday, May 22, 2006 8:52 AM
To: CF-Talk
Subject: RE: Possible in SQL?
I would have thought distinct would do what you want, are you sure you use
dit correctly.
Select distinct com1, gender, fname, lname
FROM mytable
WHERE gender = 'M'
Group by com1, gender, fname, lname
-
Snake
-Original
I have a table that looks something like this.
Com1 genderfname lname
001 M Matt Smith
001 M Bill Wright
005 FKara Brown
005 M Mike White
What I
child may have
peace'...
- Thomas Paine, The American Crisis
Let's Roll
- Todd Beamer, Flight 93
-Original Message-
From: Andy J [mailto:[EMAIL PROTECTED]
Sent: Monday, August 09, 2004 4:22 PM
To: CF-Talk
Subject: Is this possible in SQL
I have two tables which I want to query
Cheers Matt,
Worked a charm
I have two tables which I want to query at the same time. I'm thinking
something along the lines of
SELECT c.categoryid, sc.sub_CategoryId
FROM categories c, sub_category sc
WHERE c.category = '#form.searchVal#' OR sc.sub_Category =
'#form.searchVal#'
LIMIT 1
But
I have two tables which I want to query at the same time. I'm thinking
something along the lines of
SELECT c.categoryid, sc.sub_CategoryId
FROM categories c, sub_category sc
WHERE c.category = '#form.searchVal#' OR sc.sub_Category =
'#form.searchVal#'
LIMIT 1
But where this is a left join it
Have you tried union?
SELECT.
UNION
SELECT.
_
From: Andy J [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 10 August 2004 11:22 a.m.
To: CF-Talk
Subject: Is this possible in SQL
I have two tables which I want to query at the same time. I'm thinking
something along the lines of
SELECT
10 matches
Mail list logo