Results 1 to 5 of 5
  1. #1

    Default MySQL Query Please Help


    Hello istoryans, pde ko patabang sa ako problema sa MySql query ky basic pa lng ako nabal-an so di p kau ko hanas sa databases. Dghan nko way gibuhat kaso wla ghapon kya mg-ask n lng ko s mga experts dra. (No worries, wla ko gapa-spoonfeed ky ginatry ko ako best og galearn)

    May 2 tables ko naming Transaction and Guard.
    Mao ni ila structure:

    Transaction table
    cTransNo PK char(5)
    dDateStart date
    dDateEnd date
    lnDiscon decimal(1,0)

    Guard Table
    cEmpID char(5)
    dDateStart date
    dDateEnd date

    Transaction table data
    001
    2011-10-10
    2011-10-15
    0

    Guard Table data
    12345
    2011-10-05
    2011-10-13

    So ang output sa query dpat 2011-10 -10 - 2011-10-13.(bale kuhaon lng 2ng effectivity sa guard dpende sa transaction dDateStart and dDateEnd and guard dDateStart and dDateEnd)

    any help will be much appreciated!

    Thanks mga masters!

  2. #2

    Default Re: MySQL Query Please Help

    are trying to join the data?

  3. #3
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: MySQL Query Please Help

    Code:
    select concat(min(transaction.dDateStart), '-' , min(guard.dDateStart)) from transaction, guard
    suwayi daw ni...la ko mysql so nagtsambatsamba ra ko.

    Also masnindot tingali imong output i-table form sad nimo like your inputs.
    Also delete invalid data like the 0 and 12345.

    example

    Transaction table data
    2011-10-10
    2011-10-15

    Guard Table data
    2011-10-05
    2011-10-13

    Output
    2011-10 -10 - 2011-10-13
    Last edited by Klave; 11-15-2011 at 06:46 PM.

  4. #4

    Default Re: MySQL Query Please Help

    try daw ni...using php

    <?php
    $query = "Select Transaction.dDateStart,Guard.dDateEnd from Transaction,Guard";
    $result=mysql_query($query) or die('Invalid query'.mysql_error());

    while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
    echo $row['dDateStart']."-".$row['dDateEnd'];
    }
    ?>

  5. #5

    Default Re: MySQL Query Please Help

    ..ana lang bro imu untang ge foreign key ung transaction id sa guard nga table bale did2 nya tawakon ang inyang information .. dle paka mag libog ana.

  6.    Advertisement

Similar Threads

 
  1. please help me how to connect my two computer for myDSL
    By rayfloydcabrera in forum Computer Hardware
    Replies: 13
    Last Post: 11-10-2013, 08:40 PM
  2. MySQL Query Help : Foreign Keys
    By cjoyce12 in forum Programming
    Replies: 0
    Last Post: 01-06-2011, 06:57 PM
  3. HELP: in MySQL query
    By rastaman81 in forum Programming
    Replies: 19
    Last Post: 01-23-2009, 09:43 PM
  4. Need help MYSQL Query on dynamic table..
    By salbahis in forum Programming
    Replies: 6
    Last Post: 11-15-2008, 11:25 AM
  5. Replies: 2
    Last Post: 11-06-2006, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top