RE: Select Query Help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This should work as well (newer syntax) ?:

SELECT 	F.question, F.answer
FROM 		Faqs 				AS F
LEFT JOIN 	FaqsRelatedToProducts 	AS FP 	ON F.faqid = FP.faqid
WHERE		fgnumber = '$yourfgnumber'


Use:
SELECT DISTINCT ...
when your FaqsRelatedToProducts table includes identical "fgnumber-faqid"
rows.


:)
Hynek



-----Original Message-----
From: Ignatius Reilly [mailto:ignatius.reilly@free.fr]
Sent: 10. prosince 2002 23:42
To: php-db@lists.php.net; Michael Knauf/Niles
Subject: Re:  Select Query Help...


Try:

SELECT DISTINCT F.question, F.answer
FROM Faqs AS F, FaqsRelatedToProducts Table AS FP
WHERE F.faqid = FP.faqid

DTH?
Ignatius
____________________________________________
----- Original Message -----
From: "Michael Knauf/Niles" <mknauf@nilesaudio.com>
To: <php-db@lists.php.net>
Sent: Tuesday, December 10, 2002 8:53 PM
Subject:  Select Query Help...


>
> select query question
>
> OK, I have 3 tables
>
> Products Table
>       prodid
>       fgnumber
>       name
>       description
>
> Faqs Table
>       faqid
>       question
>       answer
>
> FaqsRelatedToProducts Table
>       fpid
>       fgnumber
>       faqid
>
> I want to select all the faq question and answer pairs that relate to an
> fgnumber so I need to use both the Faqs table and the
FaqsRelatedToProducts
> table, how do I make that work?
>
> Michael
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux