Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    6

    Unanswered: If ... else Begin ... end ??

    Hello,

    can someone tell me what is wrong with my if statement?
    It doesn't seem to work with begin and end. Also tried {} around them but I always get a syntax error.

    Code:
    SELECT invoice_date, invoice_nr, inv_amount, project_id, customer_id,
    klantcode = (SELECT cust_code FROM customer WHERE customer_id = invoice.customer_id),
    projectid = if(project_id = '') begin SELECT projectid FROM project WHERE projectnumber = klantcode end
    Thx for help.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Use a case statement inside select and consider changing the sub selects to joins

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •