Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Directory Submission Service   ClickBooth Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 01-02-2007, 06:41 PM   #1 (permalink)
Inactive
 
jemagee's Avatar
 
Join Date: 09-21-06
Location: Santa Barbara
Posts: 521
iTrader: 0 / 0%
Latest Blog:
None

jemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nicejemagee is just really nice
Send a message via MSN to jemagee Send a message via Yahoo to jemagee
Help - Slightly off topic I think

Ok, so this isn't purely webmastering, but I thought someone here might be able to help

Ok, again I run into a wall with my limited knowledge of SQL so far.

I ran a query on our sales database to find all customers who ordered once in the past year with a given subtotal (10 dollars) using groupby for the ID and the having clause.

701 CustomerIDs were returned. Now I need an easy way to grab the 701 email addresses linked with those customer IDs, I couldn't do a 'join' type query because of the aggrgate function of the first query.

Any Ideas?
jemagee is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 01-04-2007, 10:28 AM   #2 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,804
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
Depends on what SQL you are using. Sounds like you will have to create a temporary table with your SELECT statement. Once you have the temporary table you can do the join you need to do with the temporary table to get the right results.

MS SQL - use: SELECT * INTO tablename FROM ....etc
tablename can be a temporary table that is prefaced with # and you will want to drop after you are finished with it.

MySQL - use: INSERT INTO
Ex:
INSERT INTO tbl_temp2 (fld_id)
SELECT tbl_temp1.fld_order_id
FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100

Link to manual:
http://dev.mysql.com/doc/refman/5.1/...nto-table.html

If you are using MySQL 5 you can use similar syntax to MS SQL. The is a link to MySQL 5 version of this on the link above.

Let me know if you have more questions.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Froogle is slightly confused younghistorians Google Forum 6 01-27-2005 04:11 PM
301 with slightly different URL strings nextGoal100kVisitors Google Forum 1 06-14-2004 08:37 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 12:39 AM.
© Copyright 2008 V7 Inc