mysql - select multiple rows

  • 12 years ago
    I have a table with date and location fields. The dates are YYYY-MM-DD because I need the detail for later, but for now I want to show my data thus: YEAR1 location1 location2 location2 YEAR2 location4 location5 location6 location7 YEAR3 location8 location9 etc. Does anyone know how this can be achieved? At the moment I have multiple queries in the form "SELECT * ,YEAR(mydate) AS newdate FROM mytable WHERE YEAR(fieldtrip_date) = 'YEAR1'" This works, but I need a separate query for each year. Thanks in advance, Ian
  • 12 years ago
    Hi This is simon I am new to this forum. I think this site is providing information about Talk in your language. I think this site is to be useful to whom wants to know about languages they require to see this. ================ simon [free phr](http://www.healthycircles.com)
  • 12 years ago
    Hi This is simon I am new to this forum. I think this site is providing information about Talk in your language. I think this site is to be useful to whom wants to know about languages they require to see this. ================ simon [phr](http://www.healthycircles.com)
  • 12 years ago
    Hi, I'm not shure I anderstand your question. Do you mean something like this - SELECT * ,YEAR(mydate) AS newdate FROM mytable oredr by fieldtrip_date or like this SELECT * ,YEAR(mydate) AS newdate FROM mytable WHERE YEAR(fieldtrip_date) in ('YEAR1','YEAR2','YEAR3') or SELECT * ,YEAR(mydate) AS newdate FROM mytable WHERE YEAR(fieldtrip_date) between 'YEAR1' and 'YEAR3'

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard