Forum Moderators: open
id_ctg, int(11), auto_increment
idctg_ctg, int(11)(can be NULL)
name_ctg, varchar(100)
longname_ctg, varchar(255)
order_ctg, int(11)
The table is stored for categories, for instance
1, NULL, hardware, hardware, 1
2,1,computers,computer systems,2
3,1,printers,printers,3
4,NULL,software,software,4
I use this to navigate on a website. What I want is to show the above al follows:
hardware > computers
hardware > printers
software
The query I've tried is:
SELECT subcategories_ctg.id_ctg, CASE WHEN categories_ctg.name_ctg IS NULL THEN subcategories_ctg.name_ctg ELSE categories_ctg.name_ctg, ' > ', subcategories_ctg.name_ctg END as name_ctg
FROM categories_ctg, subcategories_ctg LEFT JOIN categories_ctg ON subcategories_ctg.idctg_ctg=categories_ctg.id_ctg
ORDER BY name_ctg
But this gives the following error:
"There is something wrong in the syntax at ' ' > ', subcategories_ctg.name_ctg END as name_ctg FROM categori' at line 1.
I am using DW8.02 to edit the queries. If anybody could tell me how to fix this, I'll be grateful, since I'm not a real specialist :).
Greetings,
Henk