Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql case when then debug issue

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
Hi All,

Am running ASP/MySQL setup and have the below select statement. Its failing on the case when then structure as below

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.0.16-nt]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 'case end, case when Merchandise_Damaged is null then 'No' else

Code:
SELECT Case_Number,Restitution_id, Civil_Demand_ID, Personal_id, system_hierarchy.Node_Label, system_hierarchy.Loc_State, Case_ID, Apprehension_Date case_type, case when disposition ='Prosecuted' then 'True' else 'False' case end, case when Merchandise_Damaged is null then 'No' else 'Yes' end case, Merchandise_Admission, merchandise_id FROM case_info inner join system_hierarchy on case_info.search_target = system_hierarchy.node_address WHERE case_info.Case_Approved = 'Yes' AND case_info.Rest_Handled IS NULL AND case_info.Record_Deleted = 'NO'...

Is it the location of the case when then items, or a syntax issue?

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
[tt]
case when disposition ='Prosecuted' then 'True' else 'False' case end,
case when Merchandise_Damaged is null then 'No' else 'Yes' end case,
[/tt]
should be:
[tt]
case when disposition ='Prosecuted' then 'True' else 'False' end,
case when Merchandise_Damaged is null then 'No' else 'Yes' end,
[/tt]
 
Thanks TOny,

Knew it was gonna be something stupid like that...

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top