Re: A little SQL help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bastien,

I think it would help if you described what result you were expecting, what version of SQL you're using, and where your error is occurring. I'm going to assume you're looking for a list of tours (including event start and end dates, event name, and result) for a specific angler (in this case, angler 1). I personally would avoid putting the CASE logic into the SQL statement. Just pull angler_results.result from the query and use PHP logic to output "N/A" instead of the results if it's NULL, at output time, especially if that's where you're having your problem.

What problem are you actually encountering though?

-P



Hi All,
Got myself stuck in a little sql here and can't seem to work out what I am doing wrong SELECT DISTINCT (tour.record_id), tour.event_start_date, tour.event_end_date, tour.event_name,CASE WHEN result is NULLTHEN 'N/A'ELSE angler_results.resultEND CASE FROM tourLEFT OUTER JOIN angler_results ON angler_results.tour_id = tour.record_idWHERE angler_results.angler_id =1 where the table TOUR is as above in the primary part of the select and table ANGLER_RESULTS is (record_id, tour_id, angler_id, result) Any ideas? Bastien

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux