עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

שאלה לתותחי SQL שבניכם

Featured Replies

פורסם

אוקיי אז יש לי Stored Procedure הבאה: שילוב של כמה SELECT כדי למשוך נתונים ממס' טבלאות

- Auctions , Profile , Bids

עכשיו הבעיה היא שאם אף אחד לא עשה BID , הווה אומר השורה ב BID ריקה שאר הנתונים לא חוזרים , וזה מציק כי אני רוצה לקבל את הנתונים חזרה בין אם מישהו עשה BID ובין אם לא

הנה הפונקציה

 ALTER PROCEDURE dbo.wcbs_auction_summery
(
@AuctionID int
)
AS

SELECT x.*, y.* , z.*
FROM
(SELECT a.AuctionTitle , a.StartingPrice as 'Starting Bid' , a.BuyoutAmount as 'Buyout Price' , a.DatePublished ,datediff(day , getdate() , a.DateOfExpire) as 'Time till end' , a.DateOfExpire
, p.City , p.Country
FROM Auctions a
INNER JOIN ProfileTable_1 p
ON a.UserID = p.UserID
WHERE a.AuctionID = @AuctionID) x ,
(SELECT u.UserName as 'Highest Bidder' , max(b.BidAmount)as 'Current Bid'
FROM Bids b
INNER JOIN aspnet_Users u
ON b.UserID = u.UserID
WHERE b.AuctionID = @AuctionID
GROUP BY u.UserName) y ,
(SELECT count(*) as '# of Bids' FROM Bids WHERE AuctionID = @AuctionID) z

פורסם

אם הבנתי נכון:

תצרף לטבלה גם timestamp

ומתי שחוזרת שורה ריקה (כשאף אחד לא עשה BID)

פשוט שיחזיר את הנתונים האחרונים שהוכנסו(אותם תשלוף אחרי שתמיין את הטבלה לפי הtimestamp)

פורסם

היי

אני מכיר טוב SQL של אורקל, ומה שכתבת פה טיפה שונה (אני לא יודע בדיוק של איזה DATABASE זה).

בכל מקרה, באורקל יש מה שנקרא OUTER JOIN. אתה מוסיף סימן (+) מימין לתנאי , למשל

(+) where bid=2

זה מביא לך גם את הרשומות שבהן bid=null

אני לא יודע איך בדיוק התחביר ב DATABASE שלך, אבל אני מניח שגם בו יש אפשרות ל OUTER JOIN.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.