Saturday, July 23, 2022

Re: Help to implement join query in django orm

Hey, you have to write custom raw query for join tables which are not connected with foreign key relationship in django.

On Sun, Jul 24, 2022, 11:17 Lalit Suthar <sutharlalit.97@gmail.com> wrote:

On Sun, 24 Jul 2022 at 00:30, Ryan Nowakowski <tubaman@fattuba.com> wrote:
On Fri, Jul 22, 2022 at 12:16:14PM +0530, Avi shah wrote:
> I have two tables
> Tbl 1
> &
> Tbl 2
>
> I need to connect the two tables using a join

If these tables were created outside of Django, in other words, not
using manage.py migrate, you can use Django's legacy database support to
auto generate the models[1].  After that, each table will have a model
associated with it.  You can then use Django's ForeignKey support to query
the tables.


[1] https://docs.djangoproject.com/en/4.0/howto/legacy-databases/


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220723185935.GB15838%40fattuba.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGp2JVHauj%2BS47HfmcYOrNQHJk3bTQbtdBm%3DdLRNx_8woM6XwQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABwiCvrSuY6AmBkARJFt%2BaCeR_wFVGf%3DKWdLP227GApDW4AcWQ%40mail.gmail.com.

No comments:

Post a Comment