Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

I want to qury on

Guest
Apr 30, 2008 Apr 30, 2008
1 I have Member table
2 their offers
Now I want to have list for only those out of hundred members who have offered (entry).
I can try like this
<cfqury name"getonlythosmemberswhoareactive" datasource"#request.datasourece#">
Select memb.*, Offer.*
From memb, Offer
where 0=0
and memb.memb_ID = offer.memb_ID
And
(Here I need help..... memb_ID 5 has 3 offers, memb_Id 9 has 6 offers, memb_ID 11 has (any number) offers and rest members have no offers yet. I want two members in list)
Select Memb_ID 5 to edit
Select Memb_ID 9 to edit
Select Memb_ID 11 to edit
how can I accomplish query for this.
515
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2008 Apr 30, 2008
adding GROUP BY memb.memb_id to your query will return only distinct
members no matter how many offers they have, if that is what you want...
i am having a bit of a hard time figuring out what exactly you are after...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2008 May 01, 2008
To start, instead of this:
Select memb.*, Offer.*
select only the fields you really need.

For the rest, your question is not clear to me either.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 01, 2008 May 01, 2008
If I say I want list of only those members who have some entry in offer table.

List of all members
where
offer table has at list 1 offer.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2008 May 01, 2008
You already have that because you joined the tables in your query.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 01, 2008 May 01, 2008
Yes I joind table and it returns but what happend is
it gives as many records as their offers are.
I want only one entry shown for one member and letter on I will link it to their entire record page.
it should be like under but I dont know how I can accomplish
where 0=0
and A_Memb.Memb_ID = O_Offere.Memb_ID
-----up to here it works fine.
now?
<cfif O_Offer record count is > than 2
Show only one entry
How can I do this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 01, 2008 May 01, 2008
LATEST
once again, use GROUP BY clause in your sql:

Select memb.*, Offer.*
FROM memb, Offer
WHERE 0=0
AND memb.memb_ID = offer.memb_ID
GROUP BY memb.memb_ID

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources