SQL Failed
/var/www/html/lawyers.lawyerlegion.com/web2/helpers/db.php @ 447
/var/www/html/lawyers.lawyerlegion.com/web2/listings.php @ 2085


		SELECT 
                `attorneys`.`ID`,
                `attorneys`.`RefID`,
                `attorneys`.`BarNumber`,
                `attorneys`.`FirstName`,
                `attorneys`.`MiddleName`,
                `attorneys`.`LastName`,
                `attorneys`.`AltFirst`,
                `attorneys`.`AltMiddle`,
                `attorneys`.`NameDisplay`,
                `attorneys`.`Suffix`,
                `attorneys`.`SiteUrl`,
                `attorneys`.`LawFirm`,
                `attorneys`.`Phone`,
                `attorneys`.`Description`,
                `attorneys`.`Tagline`, 
                `attorneys`.`IsPro`, 
                `attorney_addresses`.`StreetAddress`,
                `attorney_addresses`.`ExtendedAddress`,
                `attorney_addresses`.`City`,
                `attorney_addresses`.`County`,
                `attorney_addresses`.`State`,
                `attorney_addresses`.`ZipCode`,
                `attorney_addresses`.`Latitude`,
                `attorney_addresses`.`Longitude`, 
                


`attorney_scores`.`Value` + IF(attorney_addresses.County = , 30.00, 0)
 - IF((LawFirm LIKE "%public defender%" OR 
LawFirm LIKE "%prosecutor%" OR 
LawFirm LIKE "%attorney general%" OR 
LawFirm LIKE "%state attorney%" OR 
LawFirm LIKE "%district attorney%"), 30.00, 0)
 AS Score, 



                 `states`.`FullName` as `StateName`    
                 
                
		FROM `attorneys`
                LEFT JOIN `attorney_scores`    ON `attorney_scores`.`Attorney` = `attorneys`.`RefID`
                LEFT JOIN `attorney_addresses` ON `attorney_addresses`.`Attorney` = `attorneys`.`RefID`
                LEFT JOIN `states`             ON `states`.`ID` = `attorney_addresses`.`State`
		WHERE 
(`attorney_addresses`.`State` = 7)


 AND `attorneys`.`Pending` = 0 
 AND `attorneys`.`Deleted` = 0
 AND `attorneys`.`IsAttorney` = 1

 AND `attorney_scores`.`Site` = "lawyers.lawyerlegion.com"


 AND (attorney_addresses.ID = (
		SELECT ID
		FROM attorney_addresses
		WHERE 
                `attorney_addresses`.`Attorney` = `attorneys`.`RefID` 
 AND `attorney_addresses`.`State` = '7' 
		ORDER BY `attorney_addresses`.`Primary` + CAST(`attorney_addresses`.`State` = '7' AS UNSIGNED) * 2 DESC
		LIMIT 1
	)) GROUP BY `attorney_addresses`.`Attorney`
 HAVING (attorney_addresses.County = '')
 AND `attorney_addresses`.`County` = '' 
		ORDER BY  `Score` DESC LIMIT 0, 50;

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 30.00, 0) - IF((LawFirm LIKE "%public defender%" OR LawFirm LIKE "%prosecutor' at line 29