[thelist] Tables referencing each other
Anthony Baratta
anthony at baratta.com
Wed Mar 25 16:01:04 CDT 2009
Bill...
Another way is to cheat and use your profile table ID.
Select Top 1 * from Profile
where cust = 67
order by id DESC;
(MS SQL)
Select * from Profile
where cust = 67 and rownum = 1
order by id DESC;
(ORACLE)
Select * from Profile
where cust = 67
order by id DESC
limit 1;
(mySQL)
This way you don't have the deal with a current flag at all. The last
profile entered for a customer should be the "most current" one.
You can create a view to return only the most current profile for each
customer and select against by Cust ID that instead.
Also, you can carry the profile table ID into your order table, and that
will link to the current profile at the time of the customer order.
--
Anthony Baratta
The most wasted of all days is one without laughter.
— e.e. cummings
More information about the thelist
mailing list