query

[expired user #8298]'s profile image [expired user #8298] posted 10 years ago in General Permalink
I have a query that someone else created. I was able to update it to display birthdate. Now I want to limit results to gender = female. How do I do that?

Thanks!

USE ArenaDB
SELECT person_id,last_name,first_name,suffix as person_suffix,gender,birth_date,street_address_1 as address,city,state,postal_code,email
FROM core_v_person_basic AS a
WHERE 1 < (SELECT Count(*)
FROM core_v_person_basic AS b
WHERE b.first_name = a.first_name
AND b.last_name = a.last_name
AND b.street_address_1 = a.street_address_1
AND b.first_name <> '')
jfalch's profile image jfalch posted 10 years ago Permalink
a) buy a book on SQL for beginners. If you cannot modify such a relatively simple query, you need it.

b) in this particular case, add

AND a.gender="..."

after the ")". (first use
SELECT DISTINCT gender FROM core_v_person_basic
to find out how genders are represented in this table; then use one of these values instead of ...)
alfiqmiq's profile image alfiqmiq posted 10 years ago Permalink
I can reccommend book:http://www.amazon.com/MySQL-5th-Edition-Developers-Library/dp/0321833872

Please login to leave a reply, or register at first.