Im trying to compare two tables in a second database that is a migrated database from mssql. The second database doesn't have any apps for it, it will only be used for queries.
This are my models for the two tables. from django.db import models class invGroups(models.Model): groupID = models.SmallIntegerField(primary_key = True) categoryID = models.SmallIntegerField() def __unicode__(self): return self.item class Meta: db_table = 'invGroups' class invTypes(models.Model): typeID = models.SmallIntegerField(primary_key = True) typeName = models.CharField(max_length = 200) published = models.SmallIntegerField() groupID = models.SmallIntegerField() def __unicode__(self): return self.item class Meta: db_table = 'invTypes' And the query so far. item_search_results = invTypes.objects.using( 'DataDump' ).filter( typeName__icontains = search_query )[0:15] I currently can select from only one database, and the query is what i have so far. I tried to use ForeignKey with no results. Can I do this without using a RAW query? Im trying to achieve this query: SELECT typeName FROM invGroups, invTypes WHERE invTypes.groupID = invGroups.groupID and invGroups.categoryID in (7, 8, 9, 18, 20) and invTypes.typeName like 'query%' ORDER BY invTypes.typeName; -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.