Imagine you sell those metallic digits used to number houses, locker doors, hotel rooms, etc. You need to find how many of each digit to ship when your customer needs to number doors/houses:
The obvious solution is to do a loop from the first to the last number, convert the counter to a string with or without zeros to the left, extract each digit and use …
我想建议登录用户,如果他们的第一个选择已经采取.假设,用户想要注册为"超人".现场已经有一些超人了.登录以"Superman01","Superman02"等形式建议.所以,脚本必须:
我现在不喜欢这个模式的是它需要多个MySQL数据库请求.有没有办法一次性获得第一次无人认领的登录?也许与存储过程或聪明的SQL查询?
UPD:提供赏金
我正在将旧的会计软件移植到 SQL。这是由会计科目表组成的示例:
| 帐户 | 子账户 | 子帐目 | 子子子帐目 | 帐号 | 姓名 |
|---|---|---|---|---|---|
| 1110 | 0 | 0 | 0 | 1110 | 银行 |
| 1110 | 1 | 0 | 0 | 1110-1 | 美国银行 |
| 1110 | 1 | 1 | 0 | 1110-1-1 | 银行一 |
| 1110 | 1 | 1 | 1 | 1110-1-1-1 | 第一银行 #123456 |
| 1110 | 1 | 1 | 2 | 1110-1-1-2 | 第一银行#234567 |
| 1110 | 1 | 1 | 11 | 1110-1-1-11 | 第一银行 #11223344 |
| 1110 | 1 | 2 | 0 | 1110-1-2-0 | 银行二 |
| 1110 | 1 | 2 | 1 | 1110-1-2-1 | 第二银行#876543 |
| 1110 | 2 | 0 | 0 | 1110-2 | 外资银行 |
| 1110 | 2 | 1 | 0 | 1110-2-1 | 日本一号#556677 |
| 1120 | 0 | 0 | 0 | 1120 | 应收账款 |
| 1120 | 1 | 0 | 0 … |