![]() |
|
|
|||||||
| New! Use your Facebook, Google, AIM & Yahoo accounts to securely log into this site, click logo to login |
|
| Register | Photo Gallery | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read | Used Cars | Garage | Vendor Directory |
| Welcome to G35Driver.com! |
|
|
Welcome to G35Driver.com. You are currently viewing our forum as a guest, which gives you limited access to view most discussions and access our other features. By joining our community, at no cost, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is free, fast and simple, join G35Driver.com community today! |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL help....
Can anyone tell me why this wouldn't work? (I left out the rest, it's getting an Invalid number of arguments error)
Code:
select pvid,count(distinct ptid,d_visit)
__________________
03 BS Coupe 6MT, Inven, there's not enough spaces here... |
|
#2
|
|||
|
|||
|
Not sure about Oracle, but it works fine in mysql as long as you group the results by one of those columns.
__________________
2005 BMW M3 Coupe 6MT<<>> '97 Triumph 900 |
|
#3
|
|||
|
|||
|
It works for my MySQL too. Oracle 9i is pretty ancient. fvckin sh!t
I know I can run a subquery like Code:
select distinct ptid,d_visit from blah blah blag
__________________
03 BS Coupe 6MT, Inven, there's not enough spaces here... |
|
#4
|
||||
|
||||
|
what you wrote in your first one honestly doesn't make any sense....I think what you need is:
SELECT PVID, COUNT(*) FROM ( SELECT DISTINCT PVID, D_VISIT FROM TBL A) B GROUP BY PVID
__________________
|
|
#5
|
|||
|
|||
|
That query doesn't work Kernel.
count(distinct ptid,d_visit) is exactly what I need, but it seems Oracle 9i is too old or something.
__________________
03 BS Coupe 6MT, Inven, there's not enough spaces here... |
|
#6
|
||||
|
||||
|
by doesn't work, you mean won't run (in which case, what's the error?) or doesn't give you what you want?
Are you wanting a count of the unique ptid and d_visits? If not, write out what you want in english instead of SQL and i'll see if I can help. If you do want a count of the unique ptid and d_visits, then you just need this: SELECT COUNT(*) FROM ( SELECT DISTINCT PVID, D_VISIT FROM TBL A) B
__________________
|
|
#7
|
|||
|
|||
|
How do I do a count of distinct ptid,d_visit per each distinct pvid? And displaying like 'SELECT PVID,COUNT(*)"
__________________
03 BS Coupe 6MT, Inven, there's not enough spaces here... |
|
#8
|
||||
|
||||
|
oh, sorry, didn't notice there is a pvid and a ptid.
it's hard to do it without seeing the data, but can you not just do a distinct pvid, ptid, d_visit and then a count of that? Basically add ptid into the last subquery I have above?
__________________
|
|
#9
|
|||
|
|||
|
I think I should just extract the data, and then import it into my MySQL db so that the original query would work. I hope we upgrade to 10g
![]() Using PHP to automate the process.
__________________
03 BS Coupe 6MT, Inven, there's not enough spaces here... Last edited by pythonjosh; 11-20-2009 at 12:53 PM. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|