Jump to content

Select query


Recommended Posts

Hi, Everyone! This my first time posting here. Anyways, I've been having problem getting the correct data from my database. I want to select the total_on/off_hours,exposure,plate_number, and terminal_status. But when I select the terminal_status, there are duplicates, I already used the DISTINCT function. It's a little hard to explain so, I'll just show you.


Here's a screen cap of my code trying to get just the terminal_status





What's the problem? What should I do? Any suggestions/help will be much appreciated.

Link to comment
Share on other sites

I can't see duplicates. E.g. UVM 955 is listed twice, but one time for terminal status OFFLINE, another time for ONLINE. This seems to be correct.


Maybe you can explain a bit more detailed, what you are trying to do....



BTW: Distinct is a bad idea in aggregating queries. You have to define the "group by" clause consistent to the grouping functions. Otherwise, it will not work.

If you can explain more detailed, it's easier to solve your issue.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.