-
Need Query help.. Urgent.....
hi...
i have the tables like....
Table Name : comment
id-----userid-----comment-----added_date
1----- 10 --------- xxxxxx------- 11/1/2006 2:15:20
2----- 4 --------- xxxxxx----------11/1/2006 2:17:20
3----- 3 --------- xxxxxx----------11/1/2006 2:18:20
4-----8 --------- xxxxxx----------11/1/2006 3:18:20
Table Name : product
id-----userid-----product-----added_date
1----- 17 --------- xxxxxx------- 11/1/2006 2:15:20
2----- 5 --------- xxxxxx----------11/1/2006 4:17:20
3----- 8 --------- xxxxxx----------11/1/2006 5:18:20
i want to select the users id(last 10) for most recently added the comment or product within 2 days. If same user add the comment and product,i want that user's recent added only.
Output:
userid-----type-------------added_date
3------COMMENT-----11/1/2006 2:18:20
8------PRODUCT------11/1/2006 2:18:20
Thanks
S.Ashokkumar
-
Latest Data from 2 tables
SELECT *
FROM comment
UNION
SELECT *
FROM Product
ORDER BY added_date DESC
LIMIT 2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|