Click here to Skip to main content
15,906,081 members
Home / Discussions / Database
   

Database

 
AnswerRe: mySQL query question Pin
Chris Meech29-Apr-10 2:37
Chris Meech29-Apr-10 2:37 
QuestionHow to get the list of all dependent procedures? Pin
A M SOMAN28-Apr-10 1:48
A M SOMAN28-Apr-10 1:48 
AnswerRe: How to get the list of all dependent procedures? Pin
Henry Minute28-Apr-10 2:43
Henry Minute28-Apr-10 2:43 
AnswerRe: How to get the list of all dependent procedures? Pin
Md. Marufuzzaman28-Apr-10 22:19
professionalMd. Marufuzzaman28-Apr-10 22:19 
Questioni need a help with this problem in sql server 2005 ,, please,, please Pin
necib201028-Apr-10 0:47
necib201028-Apr-10 0:47 
AnswerRe: i need a help with this problem in sql server 2005 ,, please,, please Pin
Mycroft Holmes28-Apr-10 3:24
professionalMycroft Holmes28-Apr-10 3:24 
QuestionSelecting random top 3 listings per shop for a range of active advertising shops Pin
Graeme_Grant27-Apr-10 21:24
mvaGraeme_Grant27-Apr-10 21:24 
AnswerRe: Selecting random top 3 listings per shop for a range of active advertising shops Pin
Graeme_Grant27-Apr-10 22:13
mvaGraeme_Grant27-Apr-10 22:13 
Thanks to Lieven Thumbs Up | :thumbsup: stackoverflow.com[stackoverflow.com] for the key to solving the problem. Full solution is as follows:

SELECT AdShops.ID, Shops.url, Shops.image_url, 
       Shops.user_name AS shop_name, Shops.title, L.listing_id AS listing_id, 
       L.title AS listing_title, L.price as price,
       L.image_url AS listing_image_url, L.url AS listing_url
FROM   AdShops INNER JOIN
       Shops ON AdShops.user_id = Shops.user_id INNER JOIN
       Listings AS L ON Shops.user_id = L.user_id
WHERE  (Shops.is_vacation = 0 AND Shops.listing_count > 2 AND 
        L.listing_id IN
            (SELECT listing_id
             FROM    
                 (SELECT l2.user_id , l2.listing_id, RowNumber = ROW_NUMBER() 
                  OVER   (PARTITION BY l2.user_id ORDER BY NEWID())
                  FROM   Listings l2 INNER JOIN
                      (SELECT   user_id
                       FROM     Listings
                       GROUP BY user_id
                       HAVING   COUNT(*) >= 3
                      ) cnt ON cnt.user_id = l2.user_id  
                 ) l2 
             WHERE l2.RowNumber <= 3 and L2.user_id = L.user_id
            )
       )
ORDER BY Shops.shop_name


Anyone have any ideas on how to merge the 3 rows into a single row with the 3 listings moved into columns (several colums per listing) ???? D'Oh! | :doh:
GeneralRe: Selecting random top 3 listings per shop for a range of active advertising shops Pin
Mycroft Holmes28-Apr-10 3:21
professionalMycroft Holmes28-Apr-10 3:21 
QuestionHow Entertaining! [modified] Pin
Roger Wright27-Apr-10 17:35
professionalRoger Wright27-Apr-10 17:35 
AnswerRe: How Entertaining! Pin
_Damian S_27-Apr-10 17:41
professional_Damian S_27-Apr-10 17:41 
AnswerRe: How Entertaining! Pin
riced28-Apr-10 1:38
riced28-Apr-10 1:38 
GeneralRe: How Entertaining! Pin
Roger Wright28-Apr-10 9:08
professionalRoger Wright28-Apr-10 9:08 
GeneralRe: How Entertaining! Pin
riced28-Apr-10 9:33
riced28-Apr-10 9:33 
AnswerRe: How Entertaining! Pin
PIEBALDconsult28-Apr-10 3:52
mvePIEBALDconsult28-Apr-10 3:52 
GeneralRe: How Entertaining! Pin
Roger Wright28-Apr-10 9:10
professionalRoger Wright28-Apr-10 9:10 
GeneralRe: How Entertaining! Pin
PIEBALDconsult28-Apr-10 9:58
mvePIEBALDconsult28-Apr-10 9:58 
GeneralRe: How Entertaining! Pin
Roger Wright29-Apr-10 17:57
professionalRoger Wright29-Apr-10 17:57 
GeneralRe: How Entertaining! Pin
Richard MacCutchan28-Apr-10 9:35
mveRichard MacCutchan28-Apr-10 9:35 
GeneralRe: How Entertaining! Pin
PIEBALDconsult28-Apr-10 9:56
mvePIEBALDconsult28-Apr-10 9:56 
AnswerIt's all in the connection string Pin
The Man from U.N.C.L.E.28-Apr-10 21:47
The Man from U.N.C.L.E.28-Apr-10 21:47 
GeneralRe: It's all in the connection string Pin
Roger Wright30-Apr-10 7:01
professionalRoger Wright30-Apr-10 7:01 
General"It's all in the connection string" - or maybe not! Pin
The Man from U.N.C.L.E.4-May-10 22:30
The Man from U.N.C.L.E.4-May-10 22:30 
GeneralRe: "It's all in the connection string" - or maybe not! Pin
Roger Wright5-May-10 5:45
professionalRoger Wright5-May-10 5:45 
GeneralUpdate Pin
Roger Wright5-May-10 16:40
professionalRoger Wright5-May-10 16:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.