Foamee beer or coffee for more help
HelloI hope someone can point me in the right direction on a SQL query writing. Sorry if this is getting a bit long but I want to provide enough information to get help I need.
Here's the skinny:
I wrote a CRM system that allow users to keep their list of clients (names and mailing address, etc.). Every 2 months (Consultants) users can connect and order/send their clients (Customers) personalized mailing brochures where brochures to get a personal message printed on them to the sender.
I have a MySQL database with 4 tables.
Table 1: Consultants - registered users
Table 2: Customers - registered users
Table 3: Messages
Table 4: ConsultantOrders
The problem is that a Consultant can order more than one during each cycle.
So I want to be able to do is query the DB, find all the consultants who have placed an order - but only pull THE MOST RECENT order as the newOrder - and then extract customers all advisers to compile a master merge.
What I'm doing right now is first run a query to find consultants have several orders of the current cycle. Then I go and manually delete duplicate orders. Once it's done I then run this query:
SELECT DISTINCT
'ConsultantOrders '. "ConsultantID,"
'ConsultantOrders '. "OrderID"
"Consultants". "ConsultantID,"
"Consultants". "First name",
"Consultants". "LastName."
"Consultants". "Address1"
"Consultants". "Address2"
"Consultants". 'City ',.
"Consultants". "State":
"Consultants". "Zip,"
"Consultants". "Phone."
"Consultants". "SecondaryPhone,"
"' Consultants." EmailAddress',.
"Consultants". "Web site."
"Consultants". 'MessageID '.
"Consultants". "Authorized."
'Clients '. "First name",
'Clients '. 'Name',
'Clients '. "Address1"
'Clients '. "Address2"
'Clients '. 'City ',.
'Clients '. "State":
'Clients '. "Zip,"
'Clients '. "Language."
'Clients '. "Mail."
'Clients '. "ConsultantID,"
"Messages". 'MessageID '.
Message "Messages." "
Of
"ConsultantOrders,"
"Consultants".
Inner Join 'Customers' ON "=",
"Messages".
WHERE
"Consultants." ConsultantID' = ConsultantID of the 'ConsultantOrders '. ' AND
ConsultantID 'Customers.' ' = ConsultantID of the 'ConsultantOrders '. ' AND
Mail 'Customers.' '= ' 1' AND
MessageID "Consultants." "="Messages." MessageID' AND
Status 'Customers.' '= ' 1' AND
'Advisers.' allowed '= ' 1' AND
'ConsultantOrders '. "OrderID" > 2512
If someone can tell me how I would write a direct query to do not have to manually delete duplicate orders?
I think I need to use a function (Max), but for the life of me, I can't make it work right.
Any help would be greatly appreciated. Beer or coffee through foamee.com as a reward?
See you soon,.
Eric
AWESOME!
It worked like a charm. I just had to add a 'ON' in the first line INNER JOIN and it worked perfectly. Thanks to a bouquet.
I will send you a private message as well for a "Thank you" gift
See you soon,.
Eric
Tags: ColdFusion
Similar Questions
-
Hi all, I'm Mike. I'm a newbie here and hoping for more help with my Aspire 5735
Hi, as above, I bought the Aspire 5735 several years now. It is running Vista Home Premium SP2 and became excruciatingly slow. When first started it becomes unusable for a while during which it seems to be the continuous disk activity. I tried to look in the Task Manager to see what is happening, but that itself takes an age to start and then not show anything unusual. I also tried all the usual stuff such as disk cleanup, defragmentation and even had use CCleaner and clearing out the prefetch folder, but nothing helped.
I finally decided that the only option is to use two recovery disks that I created when it was new in an attempt to restore it to factory State but I can't find information on the way to recovery. If anyone can help with this, I would be very grateful.
Hello
Look at this french video (only photos ).
-
Smartphones Desperate blackBerry for more help
Hi all, I REALLY hope that one of you lovely people can help! I bought my 12 years the 9360 for his birthday, he arrived and he was delighted. Inserted the sim card and turned on, once he had loaded the screen appears a second before the red light comes on and it reset itself... Its been re - boot from that I tried to connect it to the laptop desk BB application, but it will not connect please help someone
Hey Derek,
I think that you are in trouble, have you not tested before buying because the rest of the process can be difficult for you and we can not say clear it will work, so if you want to try to start your machine in safe mode (you need some time to get this) as I said, and then you had to connect your device to your desktop software BlackBerry to force detection your device using the application loader How to force detection of the smartphone BlackBerry using the Application Loader
For this you need BlackBerry desktop software that you download from here BlackBerry desktop software
Try it and let you see
Prince
Click 'Like' If you want to thank someone.
If problem resolves mark message (s) as a 'Solution', so that others can use.
-
Have Photoshop Elements since 2001. A new computer with Windows 7 Professional 64 bit. It does work on my new computer. Which version is MORE SIMILAR to the old version that I have, which will take place on W7P - 64? Thanks for any help. Popjer
You should probably just download the demo version of the EP 12 and see if you can live with it.
Download a free trial version or buy Adobe products | Adobe Downloads
That being said, you tried to install PES 1 on your computer?
How much free space is on your hard drive?
You have Internet Explorer 10 or 11?
PSE 1 can run on windows 7 x 64, if certain conditions are met.
-
I tried to erase and reset my iphone 6 s. But why is it taking so long? For more than 24 hours. Is this normal? The phone displays just the apple logo and wont open. Help, please. Thank you in advance.
Hello
Follow the instructions here:
If you are unable to update or restore your iPhone, iPad or iPod touch - Apple supports
-
Mail (8,0) stop smoking. Will not be open for more than a minute or two. This has happened for several days. Help?
You have all the extensions Mail any installed? Who is your email provider?
-
I explore what I need to do to upgrade my imac. My current OS is x version 10.5.8. I read the posts on this site advises users to buy 10.6 (Snow leopard) and then upgrade more far away. Since I was only 1 GB of memory, do I need additional memory installed first? Is this possible? I have an Intel Core 2 Duo 2 GHz processor and 1 GB of memory. My Info says memory I have 1 Bank empty. Thanks for any help!
You need to install more RAM before moving to Snow Leopard and need to do before moving to Lion or newer. Buy it from a source OWC or Crucial.
(138456)
-
I try to install the Microsoft Flight Simulator X gamebut I get the error message"ERROR:-1603 FATAL INSTALLATION ERROR.Get help with Windows Installer (Msi.chm) or MSDNFor more information. »Can someone help me on this? I am using Windows XP Pro.
Hello
Can I know the computer brand and model?
I suggest you follow these methods and check.
Method 1: has access the below link and follow the steps mentioned and check.
You receive an "error 1603: a fatal error occurred during installation" error message when you try to install a Windows Installer package
http://support.Microsoft.com/kb/834484
Method 2: Refer to the following article and try the steps.
Error message when you install a Microsoft game or a mapping program http://support.Microsoft.com/kb/258496
Important: Running chkdsk on the drive if bad sectors are found on the disk hard when chkdsk attempts to repair this area if all available on which data can be lost.
I hope this helps!
-
Had sent the message about the Blue error screen.
Has been asked for more details.
I hope this helps.
BCCode: 10000050 BCP1: FFFDF6F4 BCP2: 00000001
BCP3: BF90DB41 BCP4: 00000000
OSVer: 5_1_2600 SP: 3_0 product: 768_1
Hi VASANTHFERNANDES,
· You did changes to the computer before the show?
· When exactly you receive the blue screen error?
· What is the full error message?
Follow these methods.
Method 1: Disconnect all external devices and check if the problem persists.
Method 2: Start the computer in last known good configuration and check.
How to start your computer by using last good known Windows XP Configuration
http://support.Microsoft.com/kb/307852
Method 3: Follow these steps:
Step 1: Start the computer in safe mode and check if the problem persists.
A description of the options to start in Windows XP Mode
http://support.Microsoft.com/kb/315222
Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is a software conflict as the clean boot helps eliminate software conflicts.
How to configure Windows XP to start in a "clean boot" State
http://support.Microsoft.com/kb/310353
Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.
After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.
(a) click Start, run.
(b) type msconfigand click OK.
(c) the System Configuration Utility dialog box appears.
(d) click the general tab, click Normal startup - load all services and device drivers and then click OK.
(e) when you are prompted, click on restart to restart the computer.
Method 4: Follow the steps in the article to check the drive for errors.
How to perform disk error checking in Windows XP
http://support.Microsoft.com/kb/315265
Note: If bad sectors are found in the hard drive, then it could try to fix this particular sector. If you have any data on that, it can get lost.
For reference:
Demystifying the 'Blue Screen of Death'
-
I tried to install age of empire III on my computer windows 7, but I got an error until I had to even insert the key (ERROR 1603 consult windows help install (msi.chm) or MSDM for more information). I tried to enter in the files and run the setup.exe as an administrator, but it did not help.
Anyone know why this happens and how to fix it?
AoE3 is fully compatible with Win7 and I had no problem at the facility, but it may not be compatible with
your graphics accelerator if it's an older 'integrated' graphics chip.
(This should show a different kind of error message, but sometimes Windows spits a seemingly unrelated error message.)
Try to post on AOE3 forums below. There may be someone who has had the problem with the installation of the game-
Age of Empires III heaven Forum
Age of Empires Forums - Forums
This thread is related to Vista, but you can find something useful-
Installation of Age of Empires III on a Vista based computer - Microsoft Answers
.
-
Hi there - already I bought a month of adobe stock (10 pictures per month) and cancelled it after a month. The system is not offered this choice. Help, please. It meets my needs, I won't be frozen for more than a month. Thanks Jo
Hi Joanne,
Do you mean that you're not seen the monthly plan? Can please sign in the stock site, go you to: plan pricing and membership Adobe Stock | Adobe Stock and send me a screenshot of what you see? This will help me to solve your problem.
Thank you.
EBQ
-
I get an error when I try to open my photos in photoshop cs5. the file seems to be a model of camera that is not supported by the installed version on camera raw, he said. Please see the documentation of camera raw for more information.
What should I do?
Generally help > updates can do for you and it is important to get all the updates for CS5 in.
If it fails, update Adobe Application Manager and let me know how it goes.
You can find the update here: other downloads
-
Can Hello anyone help?
After you configure Subversion in Dreamweaver, I get this error again!
SVN: 155021 #. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information about this issue, see http://www.adobe.com/go/dw_svn_en.
even after following the instructions http://www.Adobe.com/go/dw_svn_en Download the extension, python change the var in windows to say «;» C:\Python26'
with & without quotes, with or without; before C
command > comparability of Subversion to get the following error "the Conversion process has failed. Please make sure you have Python installed and you check Python PATH parameter'
I managed to get all the files after the installation, I locked, unlocked and commit a file to test fact so that was all works well, the only part I'm not retrieves the latest version, this is because Subversion is 1.6.2 and dreamweaver must revert to the version 1.4.5 on local to work, the compile someone at - it an idea what to try next in order to make it work?
Just a reminder!
- I configure Subversion through guidelines on http://help.Adobe.com/en_US/Dreamweaver/10.0_Using/WS80FE60AC-15F8-45a2-842E-52D29F540FED. html
- I managed to get the latest SVN version
- Lock, unlock and commit a file
- Installed Python in C:\Python26 change the path in windows system properties > advanced > Environment Variables > system variables > New > Python =; C:\Python26 also C:\Python26
- I also tried the same thing in the User Variables
- Installed the extension DW Subversion compatibility
Tried to run the compatibly with the command > Subversion comparability in DW
Welcome any suggestion to solve this?
Hello
There has been a lot of problems using svn with dw, and I know many people who have stopped trying to operate correctly.
As much as I know dw will not work with newer versions of svn (over 1.5), and even then, there are a lot of problems, a possible solution is to try subweaver (at- http://code.google.com/p/subweaver/ ), as this has solved some of the problems associated with the use of tsvn dw environment.
PZ
-
OK, Exactley the description of what said...
Ive been using AE for more than a year, but did not use wiggle cam because I was studying my course... I understand how it works I all click the stopwatch to null Position then wiggle (12.34) etc. (is that at the time?)
But that when I RAM Preview does nothing nothing at all... I can't work on what could I possibly missed because Ive looked at a lot of tutorials and I do exactley what the guardian did but to no avail...
SooOo bizzar and frustrated...
IM thinking maybe something to do with information wiggle? or is it a lousy option I have to reset or something?
Thank you!
Do the film layer 3D. Problem should be solved. You have no 3D elements in the scene. The camera position has no effect on a 2D layer. It would also be useful if your null was 3D.
-
Phone has been "redevelopment" iCloud drive for more than a day now
In parameters, iCloud Drive was churning "valorisation" for more than a day now. Did not help restart the phone. iPhone 6 s, iOS 10.0.2.
Thank you!
What kind of "reboot", you have? What was this - restart your iPhone, iPad or iPod touch - Apple Support? If you did, and it did not work, try switching iCloud drive, power switch (settings > iCloud > iCloud drive). If this does not work, try to connect to your iCloud account and reconnect.
Maybe you are looking for
-
Why Firefox did away with the add on bar?
I use add ons like forecast fox that I liked at the bottom of Firefox now, they came out and I was relegated to use certain add stupid to replace the add on bar It seems that FF is trying to emulate Chrome which does not have an add on bar so is anyw
-
My iPad will not hold a charge and won't
My iPad is showing a red - battery flat. If I connect it to the charger, it tries to go - see the white Apple logo and about 30 seconds later it turns off, but in another 10-15 seconds, it shows once again the flat red battery and the cycle continues
-
Convert MySQL database into usable values data
Hello After the connection to the database and retriving data out of it. How can I do something about it? Like for example I want to get an addition with the values of database.
-
seeks to the SSD in Mo 496730-001 (DV4-1225dx perhaps). Need to know what sata level is supported. I did some research and came with II, but I am not sure. Does anyone else have an idea? Thank you MattGinOK
-
I need WinZip to open the files copied to cd?
I copied some files on a dvd disc and cannot open it - what happened