Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-16-2003, 08:15 PM   #1
Member (11 bit)
 
james8547's Avatar
 
Join Date: Aug 2003
Location: NJ
Posts: 1,099
1064 MySQL Syntax Error

I am new to MySQL and I got this error in 1 of the sites that I am working on:

1064 - You have an error in your SQL syntax near 'distinct p.products_id) as total from products p left join manufacturers m usin' at line 1

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%remote%' or p.products_model like '%remote%' or m.manufacturers_name like '%remote%') )

[TEP STOP]

Any ideas on what caused this and how to fix it? This is the 1st time I encountered this kind of error. Thanks
__________________
P4 2.6C @ 3.12 || ASUS P4C800-E Dlx || Antec SOHO File Server w/ 5 case fans || Antec TruePower 430w PSU || 2 x 512MB Crucial PC3200 DDR || 280GB of total storage 7200rpm ATA100 8mb cache || LiteOn CDRW 52x32x52 || LiteOn DVD+/-RW SOHW-812S || WinXP Pro || Solarism 15" TFT LCD || 500VA TrippLite UPS || Logitech MX-700 Duo || ATI 9800 AIW || Sennheiser HD-555
james8547 is offline   Reply With Quote
Old 09-17-2003, 08:34 AM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
I'm not sure how well MySQL conforms to SQL standards, but the first thing I would do is remove the DISTINCT keyword from inside the parentheses. It should be after the SELECT keyword.
doctorgonzo is offline   Reply With Quote
Old 09-17-2003, 09:04 AM   #3
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
It should work nevertheless. The question is why do you need to use distinct anyway. If it is a product_id coming form the product table, it should be a primary key and thus unique.

Probably replace the using with an on.
mairving is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:06 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2