My query or i might be wrong?

I have one MYSQL query Which I think is right but not know it
is right or not:
it does not produce the required output as i have records in
the database:
here is the query:
<cfquery datasource="#request.dsn#" name="newclass"
username="#request.user#" password="#request.pass#">
SELECT grcat.cid,grcat.title, count(listid) as totallist
FROM grcat
LEFT JOIN grlist ON grcat.cid = grlist.cid
WHERE
parentid = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#url.cid#">
AND
active = <cfqueryparam cfsqltype="cf_sql_tinyint"
value="1">
GROUP BY
grcat.cid
</cfquery>
<cfdump var="#newclass#">

quote:
Originally posted by:
Newsgroup User
it is just a precaution against having NULL as totallist
value.
but with MySQL as your db you do not really need it since
COUNT(expr) in
MySQL will count only non-null values, and return 0 if there
are no
matching rows (i.e. if they are all NULL)
as for your problem:
1) what is the value of #url.cid# when you run your original
query?
2) are there any records in your grcat table that actually
have the
field parentid with the value of url.cid variable? run this
query to
check that you actually have the data in your table you think
you have
in there:
SELECT grcat.cid, grcat.parentid, grcat.title,
COUNT(grlist.listid) AS
totallist
FROM grcat LEFT JOIN grlist ON grcat.cid = grlist.cid
WHERE grlist.active = <cfqueryparam
cfsqltype="cf_sql_tinyint" value="1">
GROUP BY
grcat.cid
3) see if this query does what you want it to do:
SELECT grcat.cid, grcat.title, COUNT(grlist.listid) AS
totallist
FROM grcat LEFT JOIN grlist ON grcat.cid = grlist.cid AND
grlist.active
= <cfqueryparam cfsqltype="cf_sql_tinyint" value="1">
WHERE grcat.parentid = <cfqueryparam
cfsqltype="cf_sql_integer"
value="#url.cid#">
GROUP BY
grcat.cid
4) are you sure it is the parentid field you need to compare
to #url.cid# ?
5) if nothing above worked, see if this query does:
SELECT grcat.cid, grcat.title, sq_grlist.totallist
FROM grcat
LEFT JOIN
(SELECT grlist.cid, COUNT(grlist.listid) AS totallist FROM
grlist WHERE
grlist.active = <cfqueryparam cfsqltype="cf_sql_tinyint"
value="1">
GROUP BY grlist.cid) sq_grlist ON grcat.cid = sq_grlist.cid
WHERE grcat.parentid = <cfqueryparam
cfsqltype="cf_sql_integer"
value="#url.cid#">
GROUP BY
grcat.cid
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
All of the the qUERY
SELECT grcat.cid, grcat.title, COUNT(grlist.listid) AS totallist
FROM grcat LEFT JOIN grlist ON grcat.cid = grlist.cid AND
grlist.active
= <cfqueryparam cfsqltype="cf_sql_tinyint" value="1">
WHERE grcat.parentid = <cfqueryparam
cfsqltype="cf_sql_integer"
value="#url.cid#">
GROUP BY
grcat.cid
This Woked. Thanks U All Guys
Hats Off

Similar Messages

  • After I did a software update on my iPhone 5,once i emanble LTE,it loses Service/Network.What might be wrong?

    Hi,I ran a Software Update on my iPhone 5,but now if I "Enable LTE" it will display No Service and no network at all.What might be wrong here?

    It's completely situational. Without being able to directly compare the "scratch" on the original poster's iPhone with your iPhone, what gaamcc had happen could not be extrapolated to guess what Apple may do in your situation. It will depend entirely on what the Apple technician diagnoses after examining your iPhone. He/she may decide that any damage is strictly cosmetic and didn't have any connection with the problem you're taking your iPhone in for, or he/she may diagnose the problem as stemming from user damage. You'll just have to see when you go to the Apple Store.
    Regards.

  • I just got a notice to update my firefox to 4.0 and when I downloaded the new software it indicated: that I can't open the application "Firefox" because it is not supported on this architecture. Any ideas about what might be wrong and how to fix it?

    I just got a notice to update my firefox to 4.0 and when I downloaded the new software it indicated: that I can't open the application "Firefox" because it is not supported on this architecture. Any ideas about what might be wrong and how to fix it?

    Firefox 4 requires at least OS X 10.5 and an Intel Mac. There is a third party version of Firefox 4 that runs on OS X 10.4/10.5 and PPC Macs, for details see http://www.floodgap.com/software/tenfourfox
    If you prefer, you can get the latest version of Firefox 3.6 from http://www.mozilla.com/en-US/firefox/all-older.html

  • I am unable to turn my ipod on.  Suggestions for what might be wrong?

    I have my iPod plugged in to charge.  But it won't power on.  Suggestions for what might be wrong?

    If it has NEVER been jailbroke, here are some standard repair procedures:
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow the on-screen directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore (or it doesn't help), go into Recovery Mode per the instructions here.  You WILL lose all of your data (game scores, etc,) but, for the most part, you can redownload apps and music without being charged again.  Also, read this.

  • My late 2013 MBP Retina battery gets only about 4 hrs. What might be wrong?

    My late 2013 MBP Retina battery gets only about 4 hrs. What might be wrong?

    I found a solution!
    Perhaps this is just temporary, but I have my display up and working again.
    Although the symptoms are different were a bit different, the solution here worked:
    http://apple.stackexchange.com/questions/120259/grey-screen-after-login-blue-scr een-of-death-from-cmdr
    As I was able to connect to my HD via an external monitor, in the finder, I went to:
    1. Macintosh HD --> System --> Library --> Extensions
    2. From there I moved all of the files that started with ADM and ATI (19 in total for me) to a folder on my desktop. (You will need to enter your admin password for this)
    3. Next was a restart.
    4. Then my display started working again.
    5. After that, I transferred the files back into my Extensions folder.
    6. I then did another restart with my fingers crossed and breath held. It worked.
    Also... During the last few days of trying to find a fix, I restored a Mavericks backup to my computer away from Yosemite.
    I'm very sure this problem occurred when I put my MBP to sleep, disconnected the power in its sleep, while something was connected to a USB port and unplugging the USB device (for me an iPhone charger) while the MBP was closed.
    I hope this helps the next person.

  • HT5654 When I go to my shortcut on my desktop to open itunes I get Itunes.exe unable to locate component. I have tried removing it and re-install it. Any ideas what might be wrong?

    When I go to my shortcut on my desktop to open itunes I get Itunes.exe unable to locate component. I have tried removing it and re-install it. Any ideas what might be wrong?

    If in the message window it says that "...MSVCR80.dll was not found", go to this guys webpage: http://pcsupport.about.com/od/findbyerrormessage/a/msvcr80-dll-not-found-missing -error.htm.  I followed his instructions exactly and problem solved.

  • TS4006 i have lost my iphone in barcelona when i was on holiday 3-4 days ago but my device can't be located! what might be wrong? if my iphone is still turned off and not connected to the internet won't be able to be located?

    i have lost my iphone in barcelona-spain a few days ago but i can't seem to be able to track it on the map? what might be wrong? if the device is turned off/not connected to the internet,it can't be located? i dont know what to do? i think location services were on!!!

    Welcome to the Apple Community.
    You can only locate your device when it is logged into iCloud and 'Find My Phone' is enabled, additionally the device will need to be switched on and connected to a wifi or cellular network.
    Unfortunately, you cannot activate iCloud or 'Find My Phone' remotely.
    If the device is wiped by you or another, you may not be able to locate the device (although some have reported they can)

  • I can't locate an "advanced" tab in my Keynote to insert hyperlinks - any ideas onwhat might be wrong?

    The instructions said to click on the "wrench" looking tab, and click on "advanced" tools to insert hyperlinks into my presentations - there is no "advanced" tab showing up - any ideas of what might be wrong, or how to get to it?

    The "Wrench" is in the upper right hand side of Keynote for iOS. Advanced is one of the options after you click on the wrench, Interactive Hypelinks is selected from within the Advanced option. You then select an object and assign a link to it.
    Good luck.

  • A slide show with audio created in PSE 9 plays fine in edit.  When brought to Premier Elements for dvd burn, the audio no longer plays.  It appears in the edit, but no audio is played.  This happens consistently.  What setting might be wrong?

    A slide show with audio created in PSE 9 plays fine in edit.  When brought to Premier Elements for dvd burn, the audio no longer plays.  It appears in the edit, but no audio is played.  This happens consistently.  What setting might be wrong?

    H-SPhoto
    That Photoshop Elements 9.0.3 Update has generally been discouraged by the Photoshop Elements gurus. But, I am not going to factor that into this at this point.
    This is what I would ask you to look at in the Elements Organizer 9 accessed from the Photoshop Elements 9 or Premiere Elements 9.
    a. Create your slideshow in the Elements Organizer 9/Create/Slideshow/Slideshow Editor. Then use the Output option of Edit with Premiere Elements.
    From your description, you are probably using the Output Option of Burn to Disc DVD which will take your slideshow directly in the Disc Menu section of Premiere Elements 9. The preferred transfer of the Elements Organizer 9 slideshow to Premiere Elements 9 Editor is by the non wmv route "Edit with Premiere Elements" not the wmv route of Burn to Disc DVD.
    Let us explore if any of the above is involved in your issue and then we will decide what next if necessary.
    Thanks.
    ATR

  • Dvd stoped being recognized by my cumputer macbook pro the last ones made before unibody came out anybody have any suggestions as to what might be wrong?

    dvd stoped being recognized by my cumputer macbook pro the last ones made before unibody came out anybody have any suggestions as to what might be wrong?

    My eyes just glazed over...Please in the future break down each of your issues with paragraphs separated by two carriage returns. It would be much easier when trying to address your issues.
    Go to Apple menu -> System Preferences -> Keyboard and Mouse -> Mouse
    And edit your mouse settings to do what you want it to do.
    Secondly, this is not the place to vent. If you have a complaint, there is:
    http://www.apple.com/feedback/
    or http://www.apple.com/contact/
    We are just end users here helping other end users.
    Third, from my understanding, it would appear you are concerned about the noise the hard drive makes when it falls asleep? Why not put your machine in screen saver mode instead? Apple menu -> System Preferences -> Energy Saver turn off all Energy Saver settings, or set them to run Never.
    Fourth, if your machine was purchased just a few days ago, you may still be able to get an exchange from the store, quicker than you can get a repair done. You may want to look into that possibility.
    Fifth, it does appear you found the Logic forum. I would persist in asking there how to solve your technical issue with Logic regarding the audio. It may be you don't have to do anything special to the hard drive. Remember audio can be transmitted by wire, avoiding ambient sounds.
    Good luck!

  • IMac making loud beeps and freezes.  Only way to shut down is hold power button.  Any ideas what might be wrong?

    iMac making loud beeps and freezes.  Only way to shut down is hold power button.  Any ideas what might be wrong?

    iMac making loud beeps
    Could be the RAM  (memory)  
    Power On Self-Test Beep Definition - Part 2

  • When I now use the cmd-tab shortcut to go to a different open application it madly scrolls through all the open applications and does not let me select one. Any ideas as to what might be wrong. It doesn't appear to be a sticking key?

    When I now use the cmd-tab shortcut to go to a different open application it madly scrolls through all the open applications and does not let me select one. Any ideas as to what might be wrong. It doesn't appear to be a sticking key?

    Problem with the cmd-tab keyboard shortcut now cured with the latest software update, so the original problem must have been a software glitch.

  • Sap Query custom field assigned to wrong field group (in extract)

    Hello,
    I want to add an extra field to InfoSet /SAPQUERY/MEBANF at EBAN level. I added a field in a normal way:
    I fill it with a constant value. I adapted Sap Query:
    In result, I got the value in new column but only for certain rows:
    The value is there only for EBAN rows which have EBKN entries related.
    I checked the program, and my new field is added to field group %fg07 with some other fields from table EBKN (not EBAN):
    Fields from field group %fg07 are inserted to extract only in event get EBKN, so if there is no entries in EBKN, my field will not be inserted into extract:
    I tried a lot of things (assigning my field to new field group in InfoSource, adding a field on EBKN level). I can say that every extra field created by me was assigned to field group &fg07.
    Am I doing something wrong?
    The target is to add new field in the document overview panel in ME2xN transaction. I know that there is user-exit EXIT_SAPLMEQUERY_002 where I can specify a Z* query. But this solution requires a copy of InfoSet and query to Z*. Adding a new field to standard Sap query is the fastest way.
    Message was edited by: Rafal Matuszewski
    Now I tried to append EBAN table with my Z* field. I regenerated InfoSet and query but the result is still wrong:
    insert EBAN-GSFRG into %fg06.
    insert EBAN-ZUGBA into %fg06.
    insert EBKN-VBELN into %fg07.
    insert EBKN-AUFNR into %fg07.
    insert EBKN-KOSTL into %fg07.
    insert EBAN-ZZDELIV_DATE_MRP into %fg07.   <-- here again the Z* field is assigned to field group related to EBKN table

    Thanks Sandra

  • Query changes getting assigned to wrong bex request

    We have set up several packages for bex objects by functional area (SD, HR, FI, etc.)  Once I release a particular bex request, I expect that I should not be able to make a change to a query within that functional area until I assign a new bex request for that package.  This is not the case.  As long as there is a bex request available from one of the other functional areas, any new changes to this query will be recorded in an existing bex request.  Has anyone had this problem before?
    I have confirmed that all of the query elements of a particular released query are assigned to the correct package yet changes are permitted and being recorded in a request assigned to a different package.
    Any help is greatly appreciated.
    John

    Thanks for all suggestions but if I would have just read the help I would have figured out what I was doing wrong.  1) I did not immediately create a new bex request for my functional area after releasing the last assigned request. 2) I did not create a standard bex request for all bex changes that are not assigned to a special package.
    So in my scenario, because we did not create a standard bex request and I did not immediately create a new bex request for my special package, changes to my query were being written to one of the other special packages by default.

  • What might be wrong with this SQL?

    HI I am getting a failed message on Rowset near "ON" any ideas why this would fail? I am running this in a Crystal as a command.
    SELECT
    IV00101.ITMGEDSC,
    IV00101.ITEMDESC,
    RM00101.CUSTNAME,
    IV40600.UserCatLongDescr,
    CATS.UserCatLongDescr,
    SOP10200.ITEMNMBR,
    SOP10200.SOPNUMBE,
    SOP10200.QUANTITY,
    SOP10200.OXTNDPRC,
    SOP10200.SOPTYPE,
    SOP10100.DOCDATE,
    'Current' as source
    FROM
    PBS.dbo.SOP10100 SOP10100 ON
    (SOP10200.SOPTYPE=SOP10100.SOPTYPE) AND
    (SOP10200.SOPNUMBE=SOP10100.SOPNUMBE)
    INNER JOIN
    PBS.dbo.IV00101 IV00101 ON
    SOP10200.ITEMNMBR=IV00101.ITEMNMBR
    INNER JOIN
    PBS.dbo.RM00101 RM00101 ON
    SOP10100.CUSTNMBR=RM00101.CUSTNMBR
    LEFT OUTER JOIN
    PBS.dbo.IV40600 IV40600 ON
    IV00101.ITMGEDSC=IV40600.USCATVAL
    LEFT OUTER JOIN
    PBS.dbo.IV40600 CATS ON
    IV00101.USCATVLS_2=CATS.USCATVAL
    UNION
    SELECT
    IV00101.ITMGEDSC,
    IV00101.ITEMDESC,
    RM00101.CUSTNAME,
    IV40600.UserCatLongDescr,
    CATS.UserCatLongDescr,
    SOP10200.ITEMNMBR,
    SOP10200.SOPNUMBE,
    SOP10200.QUANTITY,
    SOP10200.OXTNDPRC,
    SOP10200.SOPTYPE,
    SOP10100.DOCDATE,
    'History' as source
    FROM
    PBS.dbo.SOP30200 SOP30200 ON
    (SOP30300.SOPTYPE=SOP30200.SOPTYPE) AND
    (SOP30300.SOPNUMBE=SOP30200.SOPNUMBE)
    INNER JOIN
    PBS.dbo.IV00101 IV00101 ON
    SOP30300.ITEMNMBR=IV00101.ITEMNMBR
    INNER JOIN
    PBS.dbo.RM00101 RM00101 ON
    SOP30200.CUSTNMBR=RM00101.CUSTNMBR
    LEFT OUTER JOIN
    PBS.dbo.IV40600 IV40600 ON
    IV00101.ITMGEDSC=IV40600.USCATVAL
    LEFT OUTER JOIN
    PBS.dbo.IV40600 CATS ON
    IV00101.USCATVLS_2=CATS.USCATVAL

    Philky,
    The scope of first SOP10100 is upto only the first Select statement, when you access it in the second select, you need to include it again as you have done it in the first select. I am just wondering if you are going wrong some where, I think you should query SOP30200 and SOP30300 in the second query, if not then include SOP10100 and SOP10200 in join of second select.
    SELECT
    IV00101.ITMGEDSC,
    IV00101.ITEMDESC,
    RM00101.CUSTNAME,
    IV40600.UserCatLongDescr,
    CATS.UserCatLongDescr,
    SOP10200.ITEMNMBR,
    SOP10200.SOPNUMBE,
    SOP10200.QUANTITY,
    SOP10200.OXTNDPRC,
    SOP10200.SOPTYPE,
    SOP10100.DOCDATE,
    'Current' as source
    FROM
    PBS.dbo.SOP10100 SOP10100 inner join PBS.dbo.SOP10200 SOP10200 ON
    (SOP10200.SOPTYPE=SOP10100.SOPTYPE) AND
    (SOP10200.SOPNUMBE=SOP10100.SOPNUMBE)
    INNER JOIN
    PBS.dbo.IV00101 IV00101 ON
    SOP10200.ITEMNMBR=IV00101.ITEMNMBR
    INNER JOIN
    PBS.dbo.RM00101 RM00101 ON
    SOP10100.CUSTNMBR=RM00101.CUSTNMBR
    LEFT OUTER JOIN
    PBS.dbo.IV40600 IV40600 ON
    IV00101.ITMGEDSC=IV40600.USCATVAL
    LEFT OUTER JOIN
    PBS.dbo.IV40600 CATS ON
    IV00101.USCATVLS_2=CATS.USCATVAL
    UNION
    SELECT
    IV00101.ITMGEDSC,
    IV00101.ITEMDESC,
    RM00101.CUSTNAME,
    IV40600.UserCatLongDescr,
    CATS.UserCatLongDescr,
    SOP10200.ITEMNMBR,
    SOP10200.SOPNUMBE,
    SOP10200.QUANTITY,
    SOP10200.OXTNDPRC,
    SOP10200.SOPTYPE,
    SOP10100.DOCDATE,
    'History' as source
    FROM
    PBS.dbo.SOP30200 SOP30200 inner join PBS.dbo.SOP30300 SOP30300 ON
    (SOP30300.SOPTYPE=SOP30200.SOPTYPE) AND
    (SOP30300.SOPNUMBE=SOP30200.SOPNUMBE)
    INNER JOIN
    PBS.dbo.IV00101 IV00101 ON
    SOP30300.ITEMNMBR=IV00101.ITEMNMBR
    INNER JOIN
    PBS.dbo.RM00101 RM00101 ON
    SOP30200.CUSTNMBR=RM00101.CUSTNMBR
    LEFT OUTER JOIN
    PBS.dbo.IV40600 IV40600 ON
    IV00101.ITMGEDSC=IV40600.USCATVAL
    LEFT OUTER JOIN
    PBS.dbo.IV40600 CATS ON
    IV00101.USCATVLS_2=CATS.USCATVAL
    Hope this helps,
    Thanks
    -Azhar

Maybe you are looking for

  • CCMS alert texts

    Hi Guys, ANy idea how to read the CCMS alert texts into an ABAP program? Need to capture the alert texts of a red alert in CCMS and display via a program. pls help. Will reward points if useful. Thanks a lot Leeza

  • HDV Qt playback problems

    I have a HDV 1080i50 project shot on a Z1 that i am having problems with. When i export the project as a quicktime movie the image seems very jerky when played back through QT Player. All the settings seem to be right but have heard of a possible pro

  • Can I combine a PC3200 DDR SDRAM with PC25300 DDR2 SO-DIMM when installing ram?

    Can I combine a PC3200 DDR SDRAM with PC25300 DDR2 SO-DIMM when installing ram? I am taking ram out of an iMac G5 ALS (2005) to add to the 1GB ram (3GB max) iMac late 2006 model.

  • My imac internal hard drive switch from hsf to fat 32 or ms-dos(fat)

    apple please i need your help, look i heva an imac 21 inches and the hard drive switch from hsf to fat 32 and i cant accsess to the os, i'm trying to solve the problem with the disk drill to recove my data from ann external hard drive with os x, and

  • Problem viewing Query Result

    Hi- I occasionally come across this issue when I run any query in SQL Developer (3.0.02), the Query Result tab shows a bold red Exclamation point and the display grid is blank. It says "Fetched 50 rows in 0.235 seconds" but the results aren't display