djjjozsi;10893225 wrote:you want to sort with Name, and the 2. table's value
this is in one query.
SELECT field1.ID, field1.NAME, field1.SET, field2.value
FROM field2
INNER JOIN field1 ON field2.field1_id = field1.ID
ORDER BY field1.NAME, field2.value;
I was not able to get this to work. Okay, this is in table: p_carts
The 3 fields are: cID, pName, pSetItem
I want to sort the query by pName, unless the pSetItem value matches the cID field. These will be listed just after the row with the matching cID
So, if this was the rows:
cID,pName,pSetItem
1,A,0
2,B,0
3,C,0
4,D,2
5,E,0
6,F,2
7,G,0
The sorted list would be like this:
1,A,0
2,B,0
4,D,2 <<these sorted after the cID=2 row, like a sub section of all the pSetItem=2
6,F,2
3,C,0
5,E,0
7,G,0
Given these field names, how would the query be formatted?