<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1032192" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1032192</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/sql-distinct#comment-1188598</link>
    <description> &lt;p&gt;Here are a couple options that might work for you.&lt;/p&gt;
&lt;p&gt;One solution to get a single result is to group by the product id and use a summary action on the other fields:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT products.p_id, MAX(products.p_name), MAX(products.co_id),&lt;br /&gt; MAX(cat_link_pro.c_id) FROM products INNER JOIN cat_link_pro ON products.p_id &lt;br /&gt;= cat_link_pro.p_id WHERE (products.p_name Like &amp;#039;%p%&amp;#039; OR products.p_description Like &amp;#039;%p%&amp;#039;) &lt;br /&gt;AND products.co_id=13 AND cat_link_pro.c_id=24&lt;br /&gt;GROUP BY products.p_id;&lt;/code&gt;&lt;/div&gt;&#039; &lt;/p&gt;
&lt;p&gt;A second solution would use the DISTINCT action, but only select the product id and name.  This would only work if you do not use the products.co_id and ink_pro.c_id fields from your results.  If you do use these fields then I would go with the GROUP BY option.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT DISTINCT products.p_id, products.p_name&lt;br /&gt;FROM products INNER JOIN cat_link_pro ON products.p_id &lt;br /&gt;= cat_link_pro.p_id WHERE (products.p_name Like &amp;#039;%p%&amp;#039; OR products.p_description Like &amp;#039;%p%&amp;#039;) &lt;br /&gt;AND products.co_id=13 AND cat_link_pro.c_id=24;&lt;/code&gt;&lt;/div&gt;&#039; &lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
 </description>
     <pubDate>Tue, 20 Dec 2005 17:25:25 +0000</pubDate>
 <dc:creator>altweb</dc:creator>
 <guid isPermaLink="false">comment 1188598 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/sql-distinct#comment-1188554</link>
    <description> &lt;p&gt;Hi JeevesBond,&lt;/p&gt;
&lt;p&gt;I did advise my client of the possible problems with Access but her reply was she would switch to another database if that time ever came.  She was set on using MS Access; I think she was a MS Access pro.  She wanted to design your own queries and reports...&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;
Andrew Schools&lt;/p&gt;
 </description>
     <pubDate>Tue, 20 Dec 2005 04:46:01 +0000</pubDate>
 <dc:creator>codehungry</dc:creator>
 <guid isPermaLink="false">comment 1188554 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/sql-distinct#comment-1188540</link>
    <description> &lt;p&gt;Well am glad to hear you&#039;ve got the structure normalised. You will have a problem with Access though as soon as you reach more than about 10 concurrent users. You said this is a shopping cart?&lt;/p&gt;
&lt;p&gt;Access just isn&#039;t built to cope with this kind of thing, and I&#039;m not trying to be rude here, even Bill Gates would be tut-tutting over this one!&lt;/p&gt;
&lt;p&gt;Good luck though and let us know how it goes.&lt;/p&gt;
 </description>
     <pubDate>Mon, 19 Dec 2005 21:47:23 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1188540 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/sql-distinct#comment-1188532</link>
    <description> &lt;p&gt;Hi JeevesBond,&lt;/p&gt;
&lt;p&gt;Yes, I am using a MS ACCESS database for this project and no, it&#039;s not by choice.  Originally, the application was built in PHP and MYSQL but I was forced to convert it when my client moved to a Windows Server that doesn&#039;t support PHP or MYSQL.  MS-SQL is not an option either or I would use this over MS ACCESS.&lt;/p&gt;
&lt;p&gt;In the products table, there is no data redundancy  Every product is linked to a category using a composite (bridge) entity  &lt;/p&gt;
&lt;p&gt;I have thought about using  a sub query but didn&#039;t give it much thought because I assumed it could be done using this method.  I will give this a try and let you know...&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;
Andrew Schools&lt;/p&gt;
 </description>
     <pubDate>Mon, 19 Dec 2005 19:25:04 +0000</pubDate>
 <dc:creator>codehungry</dc:creator>
 <guid isPermaLink="false">comment 1188532 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/sql-distinct#comment-1188509</link>
    <description> &lt;p&gt;Hmmm, for one thing I didn&#039;t know DISTINCTROW actually worked outside of MS Access, am assuming you&#039;re using SQL Server here (and really hoping you&#039;re not trying to build a shopping cart in Access! &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt; ). You might want to check that predicate is not only included for compatibility.&lt;/p&gt;
&lt;p&gt;Have a look at this: &lt;a href=&quot;http://www.accessvba.com/forum/archive/index.php/t-2636.html&quot; class=&quot;bb-url&quot;&gt;http://www.accessvba.com/forum/archive/index.php/t-2636.html&lt;/a&gt;&lt;br /&gt;
This relates to MS Access but should be relevant. DISTINCT works on the resultset from the query whereas DISTINCTROW works on the source tables of the query.&lt;/p&gt;
&lt;p&gt;In your case you should create a subquery to select your products - using DISTINCT, this will only retrieve unique products, then join the subquery to category after. Only problem is that your subquery cannot contain the category field as both products will be returned.&lt;/p&gt;
&lt;p&gt;In fact the more I think about this, the worse it sounds. Unfortunately it sounds like your database schema isn&#039;t right. How can you have two records in the products table that have exactly the same id but different categories?&lt;/p&gt;
&lt;p&gt;I think you&#039;re trying to create a many-to-many relationship, but without the linker table in the middle. What&#039;re the primary keys for both these tables?&lt;/p&gt;
 </description>
     <pubDate>Mon, 19 Dec 2005 13:30:31 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1188509 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
