Computer Webmaster Gaming Console Graphics Forum

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.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Database
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

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.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 06-26-2007, 12:08 AM   #1
Pawel Ratajczak
 
Pawel Ratajczak's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Order by column from other table

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 ;-)
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 06-26-2007, 12:08 AM   #2
Mark Huizer
 
Mark Huizer's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Order by column from other table

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
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 06-26-2007, 12:08 AM   #3
Pawel Ratajczak
 
Pawel Ratajczak's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Order by column from other table

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 ;-)
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 06-26-2007, 12:08 AM   #4
Pawel Ratajczak
 
Pawel Ratajczak's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Order by column from other table

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 ;-)
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

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




All times are GMT +1. The time now is 4:47 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98