Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 VP-Cart 8.00 Issues
 SQL: unique
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jack208
VP-CART New User

Malaysia
116 Posts

Posted - July 02 2017 :  14:59:13  Show Profile  Reply with Quote
I wanted to run a query to display a list of MFG names. Without duplicates. In SQL syntax, it''s similar to "unique mfg from products order by mfg asc". What''s the valid SQL to use in VPCart''s query box? TQ

jack208
VP-CART New User

Malaysia
116 Posts

Posted - July 05 2017 :  20:58:42  Show Profile  Reply with Quote
Am just going to reply my own questions.. haha.

Just realized MSSQL uses "Distinct" instead of "Unique" so it now works in VPCart Query as follows

distinct mfg from Products order by mfg asc

The above query gives me a list of manufacturers without repeating them. I actually needed something else ie a list of manufacturers and the num of items from each of them. This is the query SQL to get the answer.

select distinct mfg as [Publisher], count(*) as Count from products group by mfg
Go to Top of Page

serjtankian
VP-CART Super User

Armenia
378 Posts

Posted - July 06 2017 :  15:50:21  Show Profile  Visit serjtankian's Homepage  Reply with Quote
standard SQL using DISTINCT while SELECT UNIQUE is non-standard. in database brands other than Oracle, SELECT UNIQUE may not be recognized at all.



*peace - serj*
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00