Ask a Question related to Coldfusion Database Access, Design and Development.
-
pwizzard #1
Database Menu
I currently have a page that has a menu section that is populated from a
database table called category, the categories are for example TVs, DVDs etc,
the user can select a category and all the products within that category are
displayed, the client now wishes to change the menu to include the
manufacturers for each particular category. The manufacturers are in another
table called manufacturer which is linked to another table called products, I
have managed to join the tables together but my query returns the manufacturer
for each product, so I may for example get Sony returned several times, whereas
I really need the manufacturer that have products within that category to only
appear once.
I hope that makes sense.
<cfquery name="rsProductGroups" datasource="audiovisual">
SELECT Category.ProductGroup, Category.SidebarGraphic, Category.Ordered,
Category.CategoryID, Category.Show, Manufacturer.Manufacturer
FROM Manufacturer INNER JOIN (Category INNER JOIN Products ON
Category.CategoryID = Products.CategoryID) ON Manufacturer.ManufacturerID =
Products.ManufacturerID
WHERE Category.show = true
ORDER BY Category.Ordered desc, Manufacturer.manufacturer</cfquery>
pwizzard Guest
-
flash menu with php/mysql database
Can anyone point me in the direction of a tutorial. I want to create a flash menu and have that menu populated by accessing a php/mysql database. ... -
List Menu and database
Can some one please tell me in case of multiple selection from the List menu how can i write select statement. Thanks in advance Nike -
How do I build Drop Down menu using Menu magic with Database result
Hi Every One. I resently purched Menu Magic Dropdown System. I would like to list my database content like news( few sentense with link ), Authers... -
How can I post contents of a menu to a database?
Hello all, I've created a web form that will post to an Access database. All of the form fields correctly save to the database upon submit using:... -
Create drop down menu for database?
I have a database of bands and concerts, and was wondering if I could have a drop down menu with the band names, and when one was selected, have... -
rmorgan #2
Re: Database Menu
<cfquery name="rsProductGroups" datasource="audiovisual">
SELECT Category.ProductGroup, Category.SidebarGraphic, Category.Ordered,
Category.CategoryID, Category.Show, Manufacturer.Manufacturer
FROM Manufacturer INNER JOIN (Category INNER JOIN Products ON
Category.CategoryID = Products.CategoryID) ON Manufacturer.ManufacturerID =
Products.ManufacturerID
WHERE Category.show = true
ORDER BY Category.Ordered desc, Manufacturer.manufacturer
GROUP BY Manufacturer.manufacturer
</cfquery>
rmorgan Guest
-
pwizzard #3
Re: Database Menu
Tried that and get the following error:
Message from server: Error Executing Database Query. Syntax error (missing
operator) in query expression 'Manufacturer.manufacturer GROUP BY
Manufacturer.manufacturer'.
The error occurred on line 1.
pwizzard Guest
-
-
pwizzard #5
Re: Database Menu
I also tried that and got this error:
Message from server: Error Executing Database Query. You tried to execute a
query that does not include the specified expression 'ProductGroup' as part of
an aggregate function.
The error occurred on line 1.
pwizzard Guest
-
rmorgan #6
Re: Database Menu
Check your where statement in some flavors of sql, 'show' is a reserved word. May need to rename the column.
rmorgan Guest
-
pwizzard #7
Re: Database Menu
If I actually add all the tables to the GROUP BY Category.ProductGroup,
Category.SidebarGraphic, Category.Ordered, Category.CategoryID, Category.Show,
Manufacturer.manufacturer
it now works??
Does this make sense
Thanks for your help, very much appreciated
pwizzard Guest
-
Dan Bracuk #8
Re: Database Menu
It makes sense because that's how group by clauses work. It probably doesn't
solve your problem though. Grouping without an aggregate in the select clause
rarely accomplishes anything.
cfoutput has a group attribute that would probably be useful in your
situation. Details are in the cfml reference manual. If you don't have one,
the internet does.
Dan Bracuk Guest



Reply With Quote

