![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi, I'm a beginner in mysql and SQL area. The problem is that I've got two tables. In the first table some column is an ID (int value) in the scond table this ID is mapped on string value. Is there a way to create query that gets data form the first table and orders it according to ID column, but with string values instead of int values. Proper strings are taken of course from the second table from rows that corresponds to integer ID.? Thanks for any help in advance. -- Best regards, Pawel Ratajczak PS. User form email is written in reverse order ;-) | |||
| Advertisements |
| | #2 | ||
| The wise Pawel Ratajczak enlightened me with: > Hi, > > I'm a beginner in mysql and SQL area. > > The problem is that I've got two tables. In the first table some column is > an ID (int value) in the scond table this ID is mapped on string value. > > Is there a way to create query that gets data form the first table and > orders it according to ID column, but with string values instead of int > values. Proper strings are taken of course from the second table from rows > that corresponds to integer ID.? something like select * from table1 join table2 using(id) order by table2.stringfield ? Mark -- Terantula - Industrial Strength Open Source - http://www.terantula.com/ Projects and administration - +31 6 5140 5160 | |||
| | #3 | ||
| Mark Huizer <xaa+news_alt.comp.databases.mysql@dohd.org> wrote in news:slrnf2f21r.2h42.xaa@eeyore.local.dohd.org: > something like > select * from table1 join table2 using(id) order by table2.stringfield ? > I've checked this in MySQL Query Browser and the result was an arror with message: Unknown column 'category_id' in 'from clause' Error code: 1054 category_id is the name of the column in table1 with int values I wanted to replace with strings and order by them. Full query looked like this: select * from expenses join category using(category_id) order by category.name; Any idea what is wrong? Thanks for any help in advance. -- Best regards, Pawel Ratajczak PS. User form email is written in reverse order ;-) | |||
| | #4 | ||
| Pawel Ratajczak <10swen@pratajczak.pl> wrote in news:Xns9917B3E7847DC10swenwodzusprvpl@127.0.0.1: > Any idea what is wrong? > I've tried with success below query: SELECT table1.any_field table2.name FROM table1 LEFT JOIN table2 ON table1.name_id = table2.id ORDER BY table2.name Thanks for pointing on JOIN function. -- Best regards, Pawel Ratajczak PS. User form email is written in reverse order ;-) | |||
| Featured Websites | ||||
|
![]() |
| Tags: column, order, other, table |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete from a table using entries in temp table | n00bie | Database | 2 | 06-10-2007 12:25 AM |
| Retrieve the highest AND lowest value in column | neilr | Database | 11 | 06-10-2007 12:21 AM |
| column with type VARCHAR | ChasW | Database | 0 | 05-31-2007 8:43 PM |
| Featured Websites | ||||
|