# Auto complete for 2 tables

**URL:** <https://www.ruby-forum.com/t/auto-complete-for-2-tables/160835>\
**Category:** Rails\
**Created:** [February 20, 2009, 5:54am UTC](https://www.ruby-forum.com/t/auto-complete-for-2-tables/160835 "2009-02-20T05:54:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyadharsini](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@priyadharsini](https://www.ruby-forum.com/u/priyadharsini)\
**Post date:** [February 20, 2009, 5:54am UTC](https://www.ruby-forum.com/t/auto-complete-for-2-tables/160835/1 "2009-02-20T05:54:25Z")

</div>

Hi all,  
I’m using autocomplete in my application. I’m able to take values  
from single table for auto complete. Now i need to take values from two  
tables using many-to-many relationship.

Actually i have to tables items and orders table. Many-to-many  
relationship between these two. I have another one table items\_orders,  
which have item\_id and order\_id in it. I need to show auto complete in  
the following format

```
  "GH > Petrochemicals", where GH is in items table and

```

Petrochemicals is in orders table. Please give me some solution or  
suggestion for this. It’ll be very helpful. Thanks to all in advance.
