Use Left Outer JOIN for joining tables

AVMWeb_Items
AVMWeb_Item_Resources

INNER JOIN for joining tables
AVMWeb_Items
AVMWeb_ItemBrands
AVMWeb_ItemSubCategorys

exec sp_executeSQL and pass the two parameters

On Tue, Nov 24, 2009 at 4:09 PM, Kadir Avci <[email protected]> wrote:

> Yes, I found a problem. Which is my sql procedure.
> Here is the procedure. I will change it but I don't know how can I write it
> different.
>
> ALTER PROCEDURE [dbo].[get_AVMWeb_Items_byAnaSayfa]
>     @durum nvarchar(50),
>     @urunSay nvarchar(50)
> AS
> BEGIN
>     DECLARE @sqlStr nvarchar(4000);
>
>     set @sqlStr = 'Select top  ' + @urunSay + '  AVMWeb_Items.*, ' +
>             '(select top 1 deger from AVMWeb_Item_Resources where
> AVMWeb_Item_Resources.itemID = AVMWeb_Items.id) as deger, ' +
>             '(select top 1 deger2 from AVMWeb_Item_Resources where
> AVMWeb_Item_Resources.itemID = AVMWeb_Items.id) as deger2, ' +
>             'AVMWeb_ItemBrands.id as MarkaID, ' +
>             'AVMWeb_ItemBrands.brandname, ' +
>             'AVMWeb_ItemSubCategorys.id as AltKatID, ' +
>             'AVMWeb_ItemSubCategorys.subcatname ' +
>             'from    AVMWeb_Items, AVMWeb_ItemBrands,
> AVMWeb_ItemSubCategorys ' +
>             'where    AVMWeb_ItemBrands.id = AVMWeb_Items.brandID and ' +
>             'AVMWeb_ItemSubCategorys.id = AVMWeb_Items.subcatID and ' +
>             'AVMWeb_Items.durumanasayfaurun = ''' + @durum + ''' and ' +
>             'AVMWeb_Items.durum = ''' + @durum + ''' ' +
>             'order by NEWID()';
>     exec (@sqlStr)
> END
>
>
>
> Kadir Avcı
> Software Developer | Freelance Web Designer
> web: www.kad1r.com
> twt: www.twitter.com/kad1r
> Sent from Izmir, 35, Turkey
>
>   On Tue, Nov 24, 2009 at 12:35 PM, Processor Devil <
> [email protected]> wrote:
>
>> I would say that you have a too much large files in the layout or you
>> simply use sql querying method that is well known as "pig coding", that
>> means you use too much database queries on one page...
>>
>> 2009/11/24 Kadir Avci <[email protected]>
>>
>> Hello. I have an e-commerce web project. But this website is very slow
>>> now.
>>> How can I optimize it?
>>> Its opening time is 16sec. To long.
>>> But my other websites are good. Max opening time is 5.68 sec. But this
>>> website I don't know why time is to long. They all use same webconfig.
>>> Here is my webconfig file.
>>> http://pastebin.com/m7022555a
>>>
>>>
>>> Kadir Avcı
>>> Software Developer | Freelance Web Designer
>>> web: www.kad1r.com
>>> twt: www.twitter.com/kad1r
>>> Sent from Izmir, 35, Turkey
>>
>>
>>
>

Reply via email to