Mac OS X новые пользователи из командной строки

Следующее выражение должно возвращать ожидаемые результаты:

CONCAT(
    store_cat.name,
    IFNULL(
        CONCAT(
            ' (', 
            GROUP_CONCAT(
                store_cat_attribute.name 
                ORDER BY store_cat_attribute.position 
                SEPARATOR ', '
             ),
            ')'
        ),
        ''
    )
) AS name

По сути, это просто пытается GROUP_CONCAT() атрибуты, и если результат равен NULL, то он превращает список атрибутов пустая строка. Обратите внимание, что GROUP_CONCAT поддерживает ORDER BY.

Я также исправил предложение GROUP BY: в не древних версиях MySQL все неагрегированные столбцы должны появляться в предложении where (у вас нет store_cat.name).

Демонстрация DB Fiddle с вашими примерами данных:

SELECT 
    store_cat.id_cat AS id,
    CONCAT(
        store_cat.name,
        IFNULL(
            CONCAT(
                ' (', 
                GROUP_CONCAT(store_cat_attribute.name ORDER BY store_cat_attribute.position SEPARATOR ', '),
                ')'
            ),
            ''
        )
    ) AS name, 

    COUNT(store_item.id_item) AS products, 
    store_cat.flg_public AS flg_public 
FROM 
    store_cat 
    LEFT JOIN store_item ON store_item.id_cat = store_cat.id_cat 
    LEFT JOIN store_cat_attribute ON store_cat_attribute.id_cat = store_cat.id_cat 
WHERE store_cat.id_store = 1 
GROUP BY store_cat.id_cat, store_cat.name
ORDER BY name;
| id  | flg_public | name                  | products |
| --- | ---------- | --------------------- | -------- |
| 3   | 1          | Comidas               | 0        |
| 2   | 1          | Correas (S, M, L, XL) | 4        |
| 1   | 1          | Juguetes              | 2        |
| 4   |            | Medicinas             | 0        |

10
задан Scott Ferguson 13 May 2009 в 02:47
поделиться

3 ответа

rm /var/db/.AppleSetupDone

...and then reboot normally. With that file gone, OS X launches its first-run Setup Assistant and (among other things) lets you create a new account.

BTW, the reason niutil isn't there has nothing to do with whether it's a server or not -- it's because Apple got rid of NetInfo (its old database for storing local users) in 10.5, and replaced it with a new XML-based system. If you want to do niutil-ish things in 10.5, you can either use dscl (this is actually a bit complicated in single-user mode because directory services aren't running) or create/edit the XML files by hand.

9
ответ дан 3 December 2019 в 23:14
поделиться

Похоже, что если он неправильно создал вашу учетную запись, вам, вероятно, придется переустановить заново, если другие вещи не были настроены правильно.

-2
ответ дан 3 December 2019 в 23:14
поделиться
Другие вопросы по тегам:

Похожие вопросы: