MySqlTalk.com  

Go Back   MySqlTalk.com > MySQL > Database Design
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread
Old 03-04-2006, 07:51 PM   #1
Azkaban
Senior Member
 
Join Date: Jul 2004
Posts: 167 Azkaban is on a distinguished road
ORDER BY in Joins with same columns?

I have a problem.
I have 2 tables with the following columns

Table Books:
bookid INT(10)
productname varchar(50)
dateadded INT(10)

Table Records:
recordid INT(10)
productname varchar(50)
dateadded INT(10)

I'd like to list these in order. Since dateadded is the same column name, can I just do
ORDER BY dateadded after it's joined or do I need some other technique?
I'd also like to keep the same column name where either books or records gives the data if you know what I mean?

So the final query would be:

Code:
SELECT bookid,recordid, books.productname as name, records.productname as name, books.dateadded as dateadded, records.dateadded as dateadded ORDER BY dateadded

But that doesn't look right either. Please help!
__________________
** Most misspellings intentional to combat spaham filterz**
Azkaban is offline   Fork this post Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing CSV file for numeric columns wrandall General 2 10-19-2005 11:42 AM
Date GROUP and ORDER krcoder SQL syntax 1 02-07-2005 04:29 PM
Change row order of tables after it has been created? Azkaban Database Design 1 02-07-2005 08:35 AM
3.3 Creating and Using a Database Administrator Documentation 13 06-09-2004 04:56 PM
1.6.4 New Features Planned for the Near Future Administrator Documentation 0 06-08-2004 02:47 AM



All times are GMT -4. The time now is 06:10 AM.



Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Google
  Web http://www.mysqltalk.com
DISCLAIMERS:
1. We have no commercial interest in this site.
Banner Ads and Subscriptions will only be used to help pay for hosting and maintenance costs.
2. MySQLTalk.com is NOT affiliated with MySQL AB in any way.
3. MySQLTalk.com is NOT endorsed by MySQL AB in any way.
4. Please do not post any content that is harmful to MySQL or MySQL AB, meaning no misleading or obsolete information will be tolerated.
Well-founded constructive criticism meant to help the community is permitted.
5. This website is founded with the goal of improving the MySQL community.
We not only tolerate newbies, we encourage them.
Please do not ask newbies to "read the manual".