Any of these kinds of queries are possible, though you need to know
about SQL JOIN's to get them done.  Here are some examples:

To query a city with a specific service, you need to know the specific
service ID:

SELECT *
FROM customer
LEFT JOIN user_services ON user_services.account_number =
customer.account_number
WHERE customer.city LIKE '%Kansas City%'
AND user_services.master_service_id =3

If you wanted to query everyone with a service category you would join
the master_service table to the query:

SELECT *
FROM customer
LEFT JOIN user_services ON user_services.account_number =
customer.account_number
LEFT JOIN master_services ON master_services.id =
user_services.master_service_id
WHERE customer.city LIKE '%Kansas City%'
AND master_services.category = "dsl"

Paul

On 5/14/07, kreg <[EMAIL PROTECTED]> wrote:
> All of our users in the database have a primary contact email address.
>
> I am trying to get a list of all contact email addresses matching their City 
> and certain added Services.
>
> For example:
> I would like a list of email addresses so that I can send an email to all 
> customers who live in
> Kansas City and have DSL service for an announcement.
>
> -Kreg
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Citrusdb-users mailing list
> Citrusdb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/citrusdb-users
>


-- 
The CitrusDB Project | http://www.citrusdb.org
Open Source Customer Care & Billing System

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Citrusdb-users mailing list
Citrusdb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/citrusdb-users

Reply via email to