I ran this query on my database:
select O.ORDER_NUM, O.ORDER_DATE, O.CUSTOMER_NUM, C.CUSTOMER_NAME, C.STREET, C.CITY, C.STATE, C.ZIP from CUSTOMER C, ORDERS O where O.CUSTOMER_NUM =148 and C.CUSTOMER_NUM = 148;
+-----------+------------+--------------+--------------------------+----------------+----------+-------+-------+
| ORDER_NUM | ORDER_DATE | CUSTOMER_NUM | CUSTOMER_NAME | STREET | CITY | STATE | ZIP |
+-----------+------------+--------------+--------------------------+----------------+----------+-------+-------+
| 21608 | 2007-10-20 | 148 | Al's Appliance and Sport | 2837
Greenway | Fillmore | FL | 33336 |
| 21619 | 2007-10-23 | 148 | Al's Appliance and Sport | 2837
Greenway | Fillmore | FL | 33336 |
+-----------+------------+--------------+--------------------------+----------------+----------+-------+-------+
2 rows in set (0.00 sec)
This gives me the correct info, but i want to narrow it down even further. I would like ONLY the newest order to show up here. How can i 'comapre' the two order dates here? So that i can print just the the latest order that was made?
There is ONE last part to this...but if i can get the above - it shouldn't be too hard to figure out myself!
I am thinking a nested select statement would be needed, but doing something like:
O.ORDER_DATE < O.ODER_DATE doesnt work etc. Do i have a special date compare function or something i have to use?
Thanks for the help all!