MySQL Forums
Forum List  »  InnoDB

Re: MySQL Transact: Right Syntax
Posted by: Roland Bouman
Date: August 08, 2005 04:31PM

What version are you using? the sex column is calculated using a subquery, and those are supported in MySQL >= 4.1

However, in this particular case, you can write the query like this:

select
r.reg_man_serial_no as mrn,
r.new_ic_no as new_icno,
d.r_old_ic_no as old_icno,
d.r_name as r_name,
s.sex_code as sex
from registration_maintenance r
left join registration_maintenance_details d
on r.reg_man_serial_no=d.reg_man_serial_no
left join sex_maintenance s
on d.sex_serial_no=s.sex_serial_no
where r.reg_man_serial_no=2
and r.active_status='Y'

In fact, I would nearly always write such a query like this.

Options: ReplyQuote


Subject
Views
Written By
Posted
2811
August 08, 2005 03:21PM
Re: MySQL Transact: Right Syntax
1989
August 08, 2005 04:31PM
3349
August 09, 2005 01:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.