Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cash
Starting Member
6 Posts |
Posted - 2008-10-11 : 22:28:43
|
| Hi, Im working on a project and ran into a small problem.Check out this scenario:SELECT tbl_cart.ship_ID, tbl_products.product_Name FROM tbl_cart, tbl_products WHERE tbl_cart.sku_ID = tbl_products.SKU_ID ORDER BY tbl_cart.ship_IDreturns: ship ID product name1 12 item A2 12 item C3 30 item B4 30 item BHow can i format the query so that my results look like this instead: ship ID product name qty1 12 item A 12 12 item C 13 30 item B 2I'd sure appreciate some help on his one! Thanks!-Cash |
|
|
cash
Starting Member
6 Posts |
|
|
cash
Starting Member
6 Posts |
Posted - 2008-10-11 : 23:40:51
|
| something using syntax like:SELECT COUNT(DISTINCT) AS FROM? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-12 : 02:18:23
|
| [code]SELECTtbl_cart.ship_ID,tbl_products.product_Name,COUNT(*) AS QtyFROMtbl_cart, tbl_products WHERE tbl_cart.sku_ID = tbl_products.SKU_IDGROUP BY tbl_cart.ship_ID,tbl_products.product_NameORDER BY tbl_cart.ship_ID[/code]EDIT:had missed a space |
 |
|
|
cash
Starting Member
6 Posts |
Posted - 2008-10-12 : 14:22:03
|
| Thanks visakh16! Unfortunately, Im getting an error:Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'tbl_products.product_Name COUNT(*)'. Trying to figure out why..EDIT:OK, That was stupid, it was a missing comma after 'tbl_products.product_Name'Thanks again for your help! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-12 : 14:30:15
|
quote: Originally posted by cash Thanks visakh16! Unfortunately, Im getting an error:Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'tbl_products.product_Name COUNT(*)'. Trying to figure out why..EDIT:OK, That was stupid, it was a missing comma after 'tbl_products.product_Name'Thanks again for your help!
You're welcome Glad tht i could help you out |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-14 : 03:56:18
|
quote: Originally posted by cash Thanks visakh16! Unfortunately, Im getting an error:Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'tbl_products.product_Name COUNT(*)'. Trying to figure out why..EDIT:OK, That was stupid, it was a missing comma after 'tbl_products.product_Name'Thanks again for your help!
You should post Access Questions in Access ForumMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|