Gossamer Forum
Home : General : Databases and SQL :

I'm blind!

Quote Reply
I'm blind!
Ok..I bet I'm either being really stupid here Tongue I'm getting a problem with the following SQL statement;

SELECT * FROM Advertisers WHERE CreditLeft >= 5, Advertiser = 'Andy'


The error is;

Unable to get advertiser info. Reason: You have an error in your SQL syntax near ' Advertiser = 'Andy'' at line 1

Can anyone see why I'm getting this error? I can't for the life of me see why its not working! (I hate these memory blocks Frown)

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] I'm blind! In reply to
Umm mysql isn't going to know what bool to use unless you change that comma ;)
Quote Reply
Re: [Andy.] I'm blind! In reply to
Andy

Shouldn't that be?

Code:
SELECT * FROM Advertisers WHERE (CreditLeft >= 5) AND (Advertiser = 'Andy')

- wil
Quote Reply
Re: [Wil] I'm blind! In reply to
Yeah, got it working now. You don't need the () parts though. This was working for me;

SELECT * FROM Advertisers WHERE CreditLeft >= 5 AND Advertiser = 'Andy'

Thanks for the reply though Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] I'm blind! In reply to
Hi Andy

You don't need the parenthesis, no. But in my experience, it doesn't hurt to put them in to clarify your syntax for the sake of readability, especially if you're executing a complex query.

- wil