RE: Unsure of how to perform query and results..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

Thanks for taking the time to respond.

What am I trying to do?

Well...I am trying to build a mailing list of previous customers WHO
purchased product_id 1 but not product_id 14.

I have the product items (id's) stored in the CartTable and I have
customer info stored in the OrderTable.

Using the same column of cart_id in both CartTable and OrderTable I am
able to reference which cart items (id's) belong to each record in the
OrderTable.

What I did originally (that didn't work) was to select all records in
the CartTable that matched product_id=1 and product_id!=14 then I used
that information to reference against the OrderTable to grab the
customer information I needed.

The problem with my logic is that I did not take into account those who
purchased one of the product_id's on ONE purchase and then came back the
next day, week, year, etc and made another purchase for the other
product_id which.

I NEED to make sure that a customer HAS purchased product_id=1 and NOT
product_id=14 at ANY time, regardless of a single or multiple orders.

Does this make any sense? *sigh*

Thanks again.

Aaron

> -----Original Message-----
> From: CPT John W. Holmes [mailto:holmes072000@xxxxxxxxxxx]
> Sent: November 20, 2003 4:34 PM
> To: Aaron Wolski; php-db@xxxxxxxxxxxxx
> Subject: Re:  Unsure of how to perform query and results..
> 
> From: "Aaron Wolski" <aaronjw@xxxxxxxxxxxxx>
> 
> > I have data in a Db that looks something like:
> >
> > 14,smithcanada@xxxxxxxxxxxxx,Andrew,Smith
> > 1,smithcanada@xxxxxxxxxxxxx,Andrew,Smith
> > 14,b-richardson@xxxxxxxxxxxxxx,Barbara,Richardson
> > 1,b-richardson@xxxxxxxxxxxxxx,Barbara,Richardson
> >
> > The number represents a product_id that was purchased by the
customer in
> > question. As you can see from this example.. I have a two customers
who
> > purchased two different products.
> >
> > What I NEED to do is have one entry for each customer but with both
> > their product_id in the same result. For example:
> >
> > 14,1,smithcanada@xxxxxxxxxxxxx,Andrew,Smith
> >
> > ANY clue how I could go about getting this to work? I'm very
desperate
> > and running out of time :-(
> 
> Sorry, it's not going to happen and besides, there isn't any reason
you
> should need to return a row like that. How about you tell us what
you're
> actually trying to do and someone can help you clean up your method...
> 
> ---John Holmes...
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux