Jump to content

gusmacker

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by gusmacker

  1. Try the following.

    [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * FROM `recurring` WHERE ((`service_date` >= '2005[span style=\'color:orange\']-09-21'[/span] AND `service_date` <= '2005[span style=\'color:orange\']-09-28'[/span]) OR (`term_date` >= '2005[span style=\'color:orange\']-09-21'[/span] AND `term_date` <= '2005[span style=\'color:orange\']-09-28'[/span])) AND (`customer_number` = '0000008952')

    [!--sql2--][/div][!--sql3--]

    Note the grouping of the entire "OR"

    "((service_date <= >=) OR (term_date >= <=))"

    301329[/snapback]

     

     

    Thanks. I just caught that and was going to update the post as solved and I seen your response. This is the first time I have had to use brackets so i wasn't thinking about it that way.

     

    Kevin

  2. Ok. I don't have much hair to begin with and I am pulling it all out over this dang query.

     

    SELECT * FROM `recurring` WHERE (`service_date` >= '2005-09-21' AND `service_date` <= '2005-09-28') OR (`term_date` >= '2005-09-21' AND `term_date` <= '2005-09-28') AND (`customer_number` = '0000008952')

     

    What I am trying to do is get service dates that are great then x day but less then x day or term dates that are greater then x day and less then x day and have x as a customer number. It totaly disregards the customer number and gives me all records that match the first part. what am I doing wrong.

     

     

  3. I have a query that looks like the one below. The problem I am having is it doesn't even care about the request_status. It can be O or C (Opened Or Closed) and it will return it based on the rest of the info. How can I do a query to make sure the request_status is "O" and that the and the request_type matches one of those other ones?

     

     

    SELECT * FROM `ticket_table` WHERE `request_status` = 'o' AND `request_type` LIKE 'w-%' OR `request_type` LIKE 'd-%' OR `request_type` LIKE 'VOPN-%'

  4. Here is what I want to do, now I will ask the experts if it is possible.

     

    What I want to do is do a query such as

     

    SELECT aff from `table`

     

    then I what the uniq of that so if there are 10 that say abc in it and 15 that say fff in it I want it to just return abc and fff 1 time not their respective amounts of records.

     

    Kevin

  5. I am using a php site that was created for real estate agents. I am adding a new part to the already created program to display and link open house information to each house. I have most of it done however I have one part I am had to make some changes to and now I can\'t seem to figure out what the query would be to get it to do what I want to do. Both fields are setup as date (yyyy-mm-dd) (I believe its mm-dd and not dd-mm) Anyways I have a field start_date and one end_date basicly I want to do a query and if the date is between the start and end date or is the start or end date I want it to get those results. If it is not between those dates I don\'t want it displayed.

     

    Kevin

     

    Thanks in advance. the PHPFreaks forums have been such a blessing.

  6. I try to add a field to a existing database with phpmyAdmin and this is what I get

     

    SQL-query :  

     

    ALTER TABLE `rbl` ADD `uniq` INT( 5 ) NOT NULL AUTO_INCREMENT FIRST  

     

    MySQL said:  

     

     

    Incorrect table definition; There can only be one auto column and it must be defined as a key

×
×
  • 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.