Thread: ids and syntax
View Single Post

  #2 (permalink)  
Old 12-21-2004
George King
 
Posts: n/a
Default Re: ids and syntax


"meltedown" <fake@address.com> wrote in message
news:zeQxd.1228292$SM5.94317@news.easynews.com...
> I'm trying to get the winners of an auction and their credit card info.
>
> I used this query:
> $query = "SELECT name,nick,DECODE(creditcard,'$MD5_PREFIX') as CCN,
> card_zip, exp_month,exp_year,PHPAUCTIONXL_users.id as usersid,
> PHPAUCTIONXL_winners.id as winnersid,phone,auction, title FROM
> PHPAUCTIONXL_users, PHPAUCTIONXL_winners, PHPAUCTIONXL_auctions WHERE
> PHPAUCTIONXL_users.id = PHPAUCTIONXL_winners.winner ";
>
> The syntax checks out, but it gives me columns where the winnersid != the
> users id. How do change it to get only columns where winnersid = usersid
>
>
>
> This is another attempt- same thing but I added the last line:
>
> "SELECT name,nick,DECODE(creditcard,'$MD5_PREFIX') as CCN,
> card_zip,exp_month,exp_year,PHPAUCTIONXL_users.id as usersid,
> PHPAUCTIONXL_winners.id as winnersid,phone,auction, title FROM
> PHPAUCTIONXL_users, PHPAUCTIONXL_winners, PHPAUCTIONXL_auctions WHERE
> PHPAUCTIONXL_users.id = PHPAUCTIONXL_winners.winner
> AND PHPAUCTIONSXL_ winners.auction = PHPAUCTIONXL_auctions.id";
>
> why is this a syntax error ? I can't find the error.


Question 1: kind of hard to tell without your table layouts, but... did you
mean "where PHPAUCTIONXL_users.id = PHPAUCTIONXL_winners.id" ?

Question 2: perhaps the problem is the first "S" in
PHPAUCTIONSXL_winners.auction. Looks like a typo.

George


Reply With Quote