אשכול 10316
| נחמיה | 15.10.1122:24 |
| הולנדי | 17.10.1100:18 |
| HeaveN | 17.10.1111:28 |
ערכתי לאחרונה בתאריך 17.10.11 בשעה 11:33 בברכה, HeaveN
לפי מה שאני מבין אתה רוצה להוציא מהבטלה itemtype כמה items יש לכל type ?| HeaveN | 18.10.1111:58 |
| Deuce | 18.10.1115:26 |
ערכתי לאחרונה בתאריך 18.10.11 בשעה 15:31 בברכה, Deuce
עריכה:
SELECT TOP(N)
FROM itemtype
WHERE item_type = 1
ORDER BY itemid DESC
SELECT * FROM
(SELECT TOP(N)
FROM itemtype
WHERE item_type = 1
ORDER BY itemid DESC)
WHERE ROWNUM <= N
(1012,1)
(1010,1)
(1009,1)
(1011,2)
(1008,2)
(1005,2)
rank() over ( partition by itemtype order by itemid desc) rank
SELECT I1.*
FROM items AS I1
LEFT OUTER JOIN items AS I2
ON (I1.itemtype=I2.itemtype AND I1.itemid <= I2.itemid)
GROUP BY I1.itemtype, I1.itemid
HAVING COUNT(*) <= N
ORDER BY I1.itemtype
| נחמיה | 18.10.1117:38 |
| Deuce | 18.10.1119:03 |
) אבל יכול לתת המלצות.| נחמיה | 18.10.1119:35 |
| נחמיה | 18.10.1119:52 |
SET @count := -1, @typeid := 0;
SELECT
typeid,
itemid
FROM
(SELECT typeid, itemid FROM test ORDER BY typeid, itemid DESC) AS x
WHERE
IF(typeid != @typeid, @count := -1, 0) IS NOT NULL
AND IF(typeid != @typeid, @typeid := typeid, typeid) IS NOT NULL
AND (@count := @count + 1) < 4
[/code]
עם זאת, לא לגמרי הבנתי אותו![]()
אז אם בא לך אולי להסביר, אני אשמח![]()
| Deuce | 18.10.1121:14 |
| נחמיה | 18.10.1122:09 |
| העבר לפורום: | |
| סיבה: | |
| כותרת: | |
| תוכן: | |
| סמיילים: |
הצג
|
| כותרת: | |
| תוכן: | |
| סמיילים: |
הצג
|