|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL Code 'group by problem'
Hello everyone,
have a bit of code that needs to do a select into and group by but also needs to do a where clouse. Can anyone please help me out with the syntax. Insert into referal_URL (Page_URL, Hits, AdvertiserID) select ReferalID, count(ReferealID) as Total, AdvertiserID, Affstats from cookie_01 where Affstats group by ReferealID,AdvertiserID thanks anyone JOff |
|
#2
|
||||
|
||||
|
You are trying to insert 4 fields into a table, where you have specified you are only inserting into 3 fields.
Code:
INSERT INTO referal_URL (Page_URL, Hits, AdvertiserID) <--- 3 fields SELECT ReferalID, count(ReferealID) as Total, AdvertiserID, Affstats <--- 4 fields FROM cookie_01 WHERE Affstats GROUP BY ReferealID,AdvertiserID |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL Code 'group by problem' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|