Hello all,
I have a question about Access 2007, hope you can help me out. Here it is:
The “Customers” table:
ID Name Parent
1 A
2 B
3 C 5
4 D 1
5 E
Now I want to make a recordset look like this:
ID Name Parent
1 A
4 D 1
2 B
5 E
3 C 5
How can I do that in Access 2007?
Thanks in advance.
That works, but I don’t understand the expression. Can you explain it?
The logic is: order the child right below it’s parent.
r937
May 21, 2010, 9:21pm
4
yes, if you show me the exact query you’re running
r937
May 21, 2010, 1:52pm
5
ORDER BY COALESCE(parent,id),id
this works only if you’re using NULL in the parent column to represent no parent
oh, and you might need to use the Access NV function instead of COALESCE
Can you help me with another logic: order by name and it’s child right below?
r937:
ORDER BY COALESCE(parent,id),id
this works only if you’re using NULL in the parent column to represent no parent
oh, and you might need to use the Access NV function instead of COALESCE
I got the error “Undefined function ‘COALESCE’ in expression”.
What is Access NV function?
rpkamp
May 21, 2010, 12:45pm
8
What is the logic for the new resultset? Why did you order the records that way?
Normally to indicate in which order the results should be returned you use ORDER BY in your query, but I don’t see the logic of the order in your preferred results.
r937
May 21, 2010, 3:09pm
9
omg, typo
i meant to say NZ function
r937
May 21, 2010, 4:13pm
10